repo
stringlengths
7
58
path
stringlengths
12
218
func_name
stringlengths
3
140
original_string
stringlengths
73
34.1k
language
stringclasses
1 value
code
stringlengths
73
34.1k
code_tokens
sequence
docstring
stringlengths
3
16k
docstring_tokens
sequence
sha
stringlengths
40
40
url
stringlengths
105
339
partition
stringclasses
1 value
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/utils/linkedlist2/LinkedList.java
LinkedList.remove
public Entry remove(Entry removePointer) { if (tc.isEntryEnabled()) SibTr.entry(tc, "remove", new Object[] { removePointer }); Entry removedEntry = null; //check that the entry to be removed is not null and is in this list if(contains(removePointer)) { //call the internal unsynchronized remove method on the entry to be removed. removedEntry = removePointer.remove(); } else //if the entry is not found in this list, throw a runtime exception { SIErrorException e = new SIErrorException( nls.getFormattedMessage( "INTERNAL_MESSAGING_ERROR_CWSIP0001", new Object[] { "com.ibm.ws.sib.processor.utils.linkedlist.LinkedList", "1:291:1.3" }, null)); FFDCFilter.processException( e, "com.ibm.ws.sib.processor.utils.linkedlist.LinkedList.remove", "1:297:1.3", this); SibTr.exception(tc, e); SibTr.error(tc, "INTERNAL_MESSAGING_ERROR_CWSIP0001", new Object[] { "com.ibm.ws.sib.processor.utils.linkedlist.LinkedList", "1:304:1.3" }); if (tc.isEntryEnabled()) SibTr.exit(tc, "remove", e); throw e; } if (tc.isEntryEnabled()) SibTr.exit(tc, "remove", removedEntry); //return the object which was removed return removedEntry; }
java
public Entry remove(Entry removePointer) { if (tc.isEntryEnabled()) SibTr.entry(tc, "remove", new Object[] { removePointer }); Entry removedEntry = null; //check that the entry to be removed is not null and is in this list if(contains(removePointer)) { //call the internal unsynchronized remove method on the entry to be removed. removedEntry = removePointer.remove(); } else //if the entry is not found in this list, throw a runtime exception { SIErrorException e = new SIErrorException( nls.getFormattedMessage( "INTERNAL_MESSAGING_ERROR_CWSIP0001", new Object[] { "com.ibm.ws.sib.processor.utils.linkedlist.LinkedList", "1:291:1.3" }, null)); FFDCFilter.processException( e, "com.ibm.ws.sib.processor.utils.linkedlist.LinkedList.remove", "1:297:1.3", this); SibTr.exception(tc, e); SibTr.error(tc, "INTERNAL_MESSAGING_ERROR_CWSIP0001", new Object[] { "com.ibm.ws.sib.processor.utils.linkedlist.LinkedList", "1:304:1.3" }); if (tc.isEntryEnabled()) SibTr.exit(tc, "remove", e); throw e; } if (tc.isEntryEnabled()) SibTr.exit(tc, "remove", removedEntry); //return the object which was removed return removedEntry; }
[ "public", "Entry", "remove", "(", "Entry", "removePointer", ")", "{", "if", "(", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "entry", "(", "tc", ",", "\"remove\"", ",", "new", "Object", "[", "]", "{", "removePointer", "}", ")", ";", "Entry", "removedEntry", "=", "null", ";", "//check that the entry to be removed is not null and is in this list", "if", "(", "contains", "(", "removePointer", ")", ")", "{", "//call the internal unsynchronized remove method on the entry to be removed.", "removedEntry", "=", "removePointer", ".", "remove", "(", ")", ";", "}", "else", "//if the entry is not found in this list, throw a runtime exception", "{", "SIErrorException", "e", "=", "new", "SIErrorException", "(", "nls", ".", "getFormattedMessage", "(", "\"INTERNAL_MESSAGING_ERROR_CWSIP0001\"", ",", "new", "Object", "[", "]", "{", "\"com.ibm.ws.sib.processor.utils.linkedlist.LinkedList\"", ",", "\"1:291:1.3\"", "}", ",", "null", ")", ")", ";", "FFDCFilter", ".", "processException", "(", "e", ",", "\"com.ibm.ws.sib.processor.utils.linkedlist.LinkedList.remove\"", ",", "\"1:297:1.3\"", ",", "this", ")", ";", "SibTr", ".", "exception", "(", "tc", ",", "e", ")", ";", "SibTr", ".", "error", "(", "tc", ",", "\"INTERNAL_MESSAGING_ERROR_CWSIP0001\"", ",", "new", "Object", "[", "]", "{", "\"com.ibm.ws.sib.processor.utils.linkedlist.LinkedList\"", ",", "\"1:304:1.3\"", "}", ")", ";", "if", "(", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "exit", "(", "tc", ",", "\"remove\"", ",", "e", ")", ";", "throw", "e", ";", "}", "if", "(", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "exit", "(", "tc", ",", "\"remove\"", ",", "removedEntry", ")", ";", "//return the object which was removed", "return", "removedEntry", ";", "}" ]
Synchronized. Remove an Entry from the list. @param removePointer The Entry to be removed @return The Entry which was removed
[ "Synchronized", ".", "Remove", "an", "Entry", "from", "the", "list", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/utils/linkedlist2/LinkedList.java#L253-L299
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/utils/linkedlist2/LinkedList.java
LinkedList.getFirst
public Entry getFirst() { if (tc.isEntryEnabled()) SibTr.entry(tc, "getFirst"); if (tc.isEntryEnabled()) SibTr.exit(tc, "getFirst", first); return first; }
java
public Entry getFirst() { if (tc.isEntryEnabled()) SibTr.entry(tc, "getFirst"); if (tc.isEntryEnabled()) SibTr.exit(tc, "getFirst", first); return first; }
[ "public", "Entry", "getFirst", "(", ")", "{", "if", "(", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "entry", "(", "tc", ",", "\"getFirst\"", ")", ";", "if", "(", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "exit", "(", "tc", ",", "\"getFirst\"", ",", "first", ")", ";", "return", "first", ";", "}" ]
Synchronized. Get the first entry in the list. @return the first entry in the list.
[ "Synchronized", ".", "Get", "the", "first", "entry", "in", "the", "list", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/utils/linkedlist2/LinkedList.java#L306-L315
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/utils/linkedlist2/LinkedList.java
LinkedList.getLast
public Entry getLast() { if (tc.isEntryEnabled()) { SibTr.entry(tc, "getLast"); SibTr.exit(tc, "getLast", last); } return last; }
java
public Entry getLast() { if (tc.isEntryEnabled()) { SibTr.entry(tc, "getLast"); SibTr.exit(tc, "getLast", last); } return last; }
[ "public", "Entry", "getLast", "(", ")", "{", "if", "(", "tc", ".", "isEntryEnabled", "(", ")", ")", "{", "SibTr", ".", "entry", "(", "tc", ",", "\"getLast\"", ")", ";", "SibTr", ".", "exit", "(", "tc", ",", "\"getLast\"", ",", "last", ")", ";", "}", "return", "last", ";", "}" ]
Synchronized. Get the last entry in the list. @return the last entry in the list.
[ "Synchronized", ".", "Get", "the", "last", "entry", "in", "the", "list", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/utils/linkedlist2/LinkedList.java#L322-L331
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/LocalQPConsumerKeyGroup.java
LocalQPConsumerKeyGroup.addMemberToList
private void addMemberToList(JSConsumerKey key, boolean specificList) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry( tc, "addMemberToList", new Object[] {key, Boolean.valueOf(specificList)}); if(specificList) { if(specificKeyMembers == null) { // Our first specific member, create a list for them specificKeyMembers = new ArrayList<LocalQPConsumerKey>(); } specificKeyMembers.add((LocalQPConsumerKey)key); } else { if(generalKeyMembers == null) { // Our first specific member, create a list for them generalKeyMembers = new ArrayList<LocalQPConsumerKey>(); } generalKeyMembers.add((LocalQPConsumerKey)key); // As we've modified the list we need to reset the index generalMemberIndex = 0; } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "addMemberToList"); }
java
private void addMemberToList(JSConsumerKey key, boolean specificList) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry( tc, "addMemberToList", new Object[] {key, Boolean.valueOf(specificList)}); if(specificList) { if(specificKeyMembers == null) { // Our first specific member, create a list for them specificKeyMembers = new ArrayList<LocalQPConsumerKey>(); } specificKeyMembers.add((LocalQPConsumerKey)key); } else { if(generalKeyMembers == null) { // Our first specific member, create a list for them generalKeyMembers = new ArrayList<LocalQPConsumerKey>(); } generalKeyMembers.add((LocalQPConsumerKey)key); // As we've modified the list we need to reset the index generalMemberIndex = 0; } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "addMemberToList"); }
[ "private", "void", "addMemberToList", "(", "JSConsumerKey", "key", ",", "boolean", "specificList", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "entry", "(", "tc", ",", "\"addMemberToList\"", ",", "new", "Object", "[", "]", "{", "key", ",", "Boolean", ".", "valueOf", "(", "specificList", ")", "}", ")", ";", "if", "(", "specificList", ")", "{", "if", "(", "specificKeyMembers", "==", "null", ")", "{", "// Our first specific member, create a list for them", "specificKeyMembers", "=", "new", "ArrayList", "<", "LocalQPConsumerKey", ">", "(", ")", ";", "}", "specificKeyMembers", ".", "add", "(", "(", "LocalQPConsumerKey", ")", "key", ")", ";", "}", "else", "{", "if", "(", "generalKeyMembers", "==", "null", ")", "{", "// Our first specific member, create a list for them", "generalKeyMembers", "=", "new", "ArrayList", "<", "LocalQPConsumerKey", ">", "(", ")", ";", "}", "generalKeyMembers", ".", "add", "(", "(", "LocalQPConsumerKey", ")", "key", ")", ";", "// As we've modified the list we need to reset the index", "generalMemberIndex", "=", "0", ";", "}", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "exit", "(", "tc", ",", "\"addMemberToList\"", ")", ";", "}" ]
Add the member to the correct list @param key @param specificList
[ "Add", "the", "member", "to", "the", "correct", "list" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/LocalQPConsumerKeyGroup.java#L364-L393
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/LocalQPConsumerKeyGroup.java
LocalQPConsumerKeyGroup.removeMember
public void removeMember(JSConsumerKey key) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "removeMember", key); LocalQPConsumerKey anyKey = null; // We lock the CD so other members are not added/removed while // we do this synchronized(consumerDispatcher.getDestination().getReadyConsumerPointLock()) { if(singleMember != null) { if(!(key.isSpecific())) generalMemberCount--; if(singleMember == key) singleMember = null; else { // We must be the only member if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "removeMember", "SIErrorException"); throw new SIErrorException( nls.getFormattedMessage( "INTERNAL_MESSAGING_ERROR_CWSIP0001", new Object[] { "com.ibm.ws.sib.processor.impl.LocalQPConsumerKeyGroup", "1:453:1.6.1.14" }, null)); } } else { if(key.isSpecific()) specificKeyMembers.remove(key); else { generalKeyMembers.remove(key); generalMemberCount--; // As we've modified the list we need a new iterator generalMemberIndex = 0; } } memberCount--; // If that was the last member, we can remove this group if(memberCount == 0) { consumerDispatcher.removeKeyGroup(this); // Drive finished against the set of cursors if(classifyingMessages) { // Take the classifications read lock consumerSet.takeClassificationReadLock(); int numFilters = consumerKeyFilter.length; for(int i=0;i<numFilters;i++) consumerKeyFilter[i].detach(); // Free the classifications read lock consumerSet.freeClassificationReadLock(); } else { consumerKeyFilter[0].detach(); } } // If all the remaining members are started we can start receiving // messages again (we couldn't have been before because the member // was in stopped state. else if(memberCount == startedCount) { if(generalMemberCount > 0) anyKey = generalKeyMembers.get(0); else anyKey = specificKeyMembers.get(0); } } // synchronized // Start the member up if(anyKey!=null) anyKey.getConsumerPoint().checkForMessages(); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "removeMember"); }
java
public void removeMember(JSConsumerKey key) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "removeMember", key); LocalQPConsumerKey anyKey = null; // We lock the CD so other members are not added/removed while // we do this synchronized(consumerDispatcher.getDestination().getReadyConsumerPointLock()) { if(singleMember != null) { if(!(key.isSpecific())) generalMemberCount--; if(singleMember == key) singleMember = null; else { // We must be the only member if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "removeMember", "SIErrorException"); throw new SIErrorException( nls.getFormattedMessage( "INTERNAL_MESSAGING_ERROR_CWSIP0001", new Object[] { "com.ibm.ws.sib.processor.impl.LocalQPConsumerKeyGroup", "1:453:1.6.1.14" }, null)); } } else { if(key.isSpecific()) specificKeyMembers.remove(key); else { generalKeyMembers.remove(key); generalMemberCount--; // As we've modified the list we need a new iterator generalMemberIndex = 0; } } memberCount--; // If that was the last member, we can remove this group if(memberCount == 0) { consumerDispatcher.removeKeyGroup(this); // Drive finished against the set of cursors if(classifyingMessages) { // Take the classifications read lock consumerSet.takeClassificationReadLock(); int numFilters = consumerKeyFilter.length; for(int i=0;i<numFilters;i++) consumerKeyFilter[i].detach(); // Free the classifications read lock consumerSet.freeClassificationReadLock(); } else { consumerKeyFilter[0].detach(); } } // If all the remaining members are started we can start receiving // messages again (we couldn't have been before because the member // was in stopped state. else if(memberCount == startedCount) { if(generalMemberCount > 0) anyKey = generalKeyMembers.get(0); else anyKey = specificKeyMembers.get(0); } } // synchronized // Start the member up if(anyKey!=null) anyKey.getConsumerPoint().checkForMessages(); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "removeMember"); }
[ "public", "void", "removeMember", "(", "JSConsumerKey", "key", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "entry", "(", "tc", ",", "\"removeMember\"", ",", "key", ")", ";", "LocalQPConsumerKey", "anyKey", "=", "null", ";", "// We lock the CD so other members are not added/removed while", "// we do this", "synchronized", "(", "consumerDispatcher", ".", "getDestination", "(", ")", ".", "getReadyConsumerPointLock", "(", ")", ")", "{", "if", "(", "singleMember", "!=", "null", ")", "{", "if", "(", "!", "(", "key", ".", "isSpecific", "(", ")", ")", ")", "generalMemberCount", "--", ";", "if", "(", "singleMember", "==", "key", ")", "singleMember", "=", "null", ";", "else", "{", "// We must be the only member", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "exit", "(", "tc", ",", "\"removeMember\"", ",", "\"SIErrorException\"", ")", ";", "throw", "new", "SIErrorException", "(", "nls", ".", "getFormattedMessage", "(", "\"INTERNAL_MESSAGING_ERROR_CWSIP0001\"", ",", "new", "Object", "[", "]", "{", "\"com.ibm.ws.sib.processor.impl.LocalQPConsumerKeyGroup\"", ",", "\"1:453:1.6.1.14\"", "}", ",", "null", ")", ")", ";", "}", "}", "else", "{", "if", "(", "key", ".", "isSpecific", "(", ")", ")", "specificKeyMembers", ".", "remove", "(", "key", ")", ";", "else", "{", "generalKeyMembers", ".", "remove", "(", "key", ")", ";", "generalMemberCount", "--", ";", "// As we've modified the list we need a new iterator", "generalMemberIndex", "=", "0", ";", "}", "}", "memberCount", "--", ";", "// If that was the last member, we can remove this group", "if", "(", "memberCount", "==", "0", ")", "{", "consumerDispatcher", ".", "removeKeyGroup", "(", "this", ")", ";", "// Drive finished against the set of cursors", "if", "(", "classifyingMessages", ")", "{", "// Take the classifications read lock", "consumerSet", ".", "takeClassificationReadLock", "(", ")", ";", "int", "numFilters", "=", "consumerKeyFilter", ".", "length", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "numFilters", ";", "i", "++", ")", "consumerKeyFilter", "[", "i", "]", ".", "detach", "(", ")", ";", "// Free the classifications read lock", "consumerSet", ".", "freeClassificationReadLock", "(", ")", ";", "}", "else", "{", "consumerKeyFilter", "[", "0", "]", ".", "detach", "(", ")", ";", "}", "}", "// If all the remaining members are started we can start receiving", "// messages again (we couldn't have been before because the member", "// was in stopped state.", "else", "if", "(", "memberCount", "==", "startedCount", ")", "{", "if", "(", "generalMemberCount", ">", "0", ")", "anyKey", "=", "generalKeyMembers", ".", "get", "(", "0", ")", ";", "else", "anyKey", "=", "specificKeyMembers", ".", "get", "(", "0", ")", ";", "}", "}", "// synchronized", "// Start the member up", "if", "(", "anyKey", "!=", "null", ")", "anyKey", ".", "getConsumerPoint", "(", ")", ".", "checkForMessages", "(", ")", ";", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "exit", "(", "tc", ",", "\"removeMember\"", ")", ";", "}" ]
Remove a member from the group @param key
[ "Remove", "a", "member", "from", "the", "group" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/LocalQPConsumerKeyGroup.java#L399-L486
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/LocalQPConsumerKeyGroup.java
LocalQPConsumerKeyGroup.resolvedKey
public LocalQPConsumerKey resolvedKey() { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "resolvedKey"); LocalQPConsumerKey key = null; if(generalMemberCount > 0) { // If we only have one this is easy if(singleMember != null) key = singleMember; // Otherwise, we try to be a little fair and pick the next one in // the list else { key = generalKeyMembers.get(generalMemberIndex); // Wrap the index if required if(++generalMemberIndex == generalMemberCount) generalMemberIndex = 0; } } else { // We should have at least one of these if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "resolvedKey", "SIErrorException"); throw new SIErrorException( nls.getFormattedMessage( "INTERNAL_MESSAGING_ERROR_CWSIP0001", new Object[] { "com.ibm.ws.sib.processor.impl.LocalQPConsumerKeyGroup", "1:688:1.6.1.14" }, null)); } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "resolvedKey", key); return key; }
java
public LocalQPConsumerKey resolvedKey() { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "resolvedKey"); LocalQPConsumerKey key = null; if(generalMemberCount > 0) { // If we only have one this is easy if(singleMember != null) key = singleMember; // Otherwise, we try to be a little fair and pick the next one in // the list else { key = generalKeyMembers.get(generalMemberIndex); // Wrap the index if required if(++generalMemberIndex == generalMemberCount) generalMemberIndex = 0; } } else { // We should have at least one of these if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "resolvedKey", "SIErrorException"); throw new SIErrorException( nls.getFormattedMessage( "INTERNAL_MESSAGING_ERROR_CWSIP0001", new Object[] { "com.ibm.ws.sib.processor.impl.LocalQPConsumerKeyGroup", "1:688:1.6.1.14" }, null)); } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "resolvedKey", key); return key; }
[ "public", "LocalQPConsumerKey", "resolvedKey", "(", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "entry", "(", "tc", ",", "\"resolvedKey\"", ")", ";", "LocalQPConsumerKey", "key", "=", "null", ";", "if", "(", "generalMemberCount", ">", "0", ")", "{", "// If we only have one this is easy", "if", "(", "singleMember", "!=", "null", ")", "key", "=", "singleMember", ";", "// Otherwise, we try to be a little fair and pick the next one in", "// the list", "else", "{", "key", "=", "generalKeyMembers", ".", "get", "(", "generalMemberIndex", ")", ";", "// Wrap the index if required", "if", "(", "++", "generalMemberIndex", "==", "generalMemberCount", ")", "generalMemberIndex", "=", "0", ";", "}", "}", "else", "{", "// We should have at least one of these", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "exit", "(", "tc", ",", "\"resolvedKey\"", ",", "\"SIErrorException\"", ")", ";", "throw", "new", "SIErrorException", "(", "nls", ".", "getFormattedMessage", "(", "\"INTERNAL_MESSAGING_ERROR_CWSIP0001\"", ",", "new", "Object", "[", "]", "{", "\"com.ibm.ws.sib.processor.impl.LocalQPConsumerKeyGroup\"", ",", "\"1:688:1.6.1.14\"", "}", ",", "null", ")", ")", ";", "}", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "exit", "(", "tc", ",", "\"resolvedKey\"", ",", "key", ")", ";", "return", "key", ";", "}" ]
Return one of the groups non-specific members
[ "Return", "one", "of", "the", "groups", "non", "-", "specific", "members" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/LocalQPConsumerKeyGroup.java#L630-L669
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/LocalQPConsumerKeyGroup.java
LocalQPConsumerKeyGroup.setConsumerActive
public void setConsumerActive(boolean active) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "setConsumerActive", active); if(active) { consumerThreadID = Thread.currentThread().getId(); } else { consumerThreadID = 0; } consumerThreadActive = active; if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "setConsumerActive", consumerThreadID); }
java
public void setConsumerActive(boolean active) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "setConsumerActive", active); if(active) { consumerThreadID = Thread.currentThread().getId(); } else { consumerThreadID = 0; } consumerThreadActive = active; if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "setConsumerActive", consumerThreadID); }
[ "public", "void", "setConsumerActive", "(", "boolean", "active", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "entry", "(", "tc", ",", "\"setConsumerActive\"", ",", "active", ")", ";", "if", "(", "active", ")", "{", "consumerThreadID", "=", "Thread", ".", "currentThread", "(", ")", ".", "getId", "(", ")", ";", "}", "else", "{", "consumerThreadID", "=", "0", ";", "}", "consumerThreadActive", "=", "active", ";", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "exit", "(", "tc", ",", "\"setConsumerActive\"", ",", "consumerThreadID", ")", ";", "}" ]
We only want to remember the result of a filter match if it is called as a result of a consumer asking for a message. The consumer indicates that it is asking for a message by calling this method with active set to true. After the consumer has got it's message it should call again with active false. This is because the filterMatches method can get called at any time by threads other than the consumers' thread. Previously, if this happened while the consumer was trying to get a message, the match results were lost or changed. @param active
[ "We", "only", "want", "to", "remember", "the", "result", "of", "a", "filter", "match", "if", "it", "is", "called", "as", "a", "result", "of", "a", "consumer", "asking", "for", "a", "message", ".", "The", "consumer", "indicates", "that", "it", "is", "asking", "for", "a", "message", "by", "calling", "this", "method", "with", "active", "set", "to", "true", ".", "After", "the", "consumer", "has", "got", "it", "s", "message", "it", "should", "call", "again", "with", "active", "false", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/LocalQPConsumerKeyGroup.java#L827-L843
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/LocalQPConsumerKeyGroup.java
LocalQPConsumerKeyGroup.filterMatches
public boolean filterMatches(AbstractItem item) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "filterMatches", item); boolean match = false; LocalQPConsumerKey matchingMember = null; // Hopefully we have a general consumer so we don't need to parse the message if(generalMemberCount > 0) { // We have a match but we don't care which one out of the general members // actually takes the message, so if one of the general members is the one // performing the scan they can take the message. matchingMember = null; match = true; } // Damn, all we've got are members with selectors, we'll have to parse the message else { // If there is just the single member see if they match the message if(singleMember != null) { if(singleMember.filterMatches(item)) { match = true; matchingMember = singleMember; } } // Otherwise we give all the members a chance to match it else { LocalQPConsumerKey keyMember; int index; int size = specificKeyMembers.size(); for(index = 0; (index < size) && !match; index++) { keyMember = specificKeyMembers.get(index); // Drop out if one of the members matches it if(keyMember.filterMatches(item)) { match = true; matchingMember = keyMember; } } } } // we only want to remember this result if get got here as a result of a consumer //asking for a message. boolean onConsumerThread = consumerThreadActive && (Thread.currentThread().getId() == consumerThreadID); if(onConsumerThread) { currentMatch = match; currentMatchingMember = matchingMember; } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "filterMatches", new Object[] {Boolean.valueOf(match), matchingMember}); return match; }
java
public boolean filterMatches(AbstractItem item) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "filterMatches", item); boolean match = false; LocalQPConsumerKey matchingMember = null; // Hopefully we have a general consumer so we don't need to parse the message if(generalMemberCount > 0) { // We have a match but we don't care which one out of the general members // actually takes the message, so if one of the general members is the one // performing the scan they can take the message. matchingMember = null; match = true; } // Damn, all we've got are members with selectors, we'll have to parse the message else { // If there is just the single member see if they match the message if(singleMember != null) { if(singleMember.filterMatches(item)) { match = true; matchingMember = singleMember; } } // Otherwise we give all the members a chance to match it else { LocalQPConsumerKey keyMember; int index; int size = specificKeyMembers.size(); for(index = 0; (index < size) && !match; index++) { keyMember = specificKeyMembers.get(index); // Drop out if one of the members matches it if(keyMember.filterMatches(item)) { match = true; matchingMember = keyMember; } } } } // we only want to remember this result if get got here as a result of a consumer //asking for a message. boolean onConsumerThread = consumerThreadActive && (Thread.currentThread().getId() == consumerThreadID); if(onConsumerThread) { currentMatch = match; currentMatchingMember = matchingMember; } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "filterMatches", new Object[] {Boolean.valueOf(match), matchingMember}); return match; }
[ "public", "boolean", "filterMatches", "(", "AbstractItem", "item", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "entry", "(", "tc", ",", "\"filterMatches\"", ",", "item", ")", ";", "boolean", "match", "=", "false", ";", "LocalQPConsumerKey", "matchingMember", "=", "null", ";", "// Hopefully we have a general consumer so we don't need to parse the message", "if", "(", "generalMemberCount", ">", "0", ")", "{", "// We have a match but we don't care which one out of the general members", "// actually takes the message, so if one of the general members is the one", "// performing the scan they can take the message.", "matchingMember", "=", "null", ";", "match", "=", "true", ";", "}", "// Damn, all we've got are members with selectors, we'll have to parse the message", "else", "{", "// If there is just the single member see if they match the message", "if", "(", "singleMember", "!=", "null", ")", "{", "if", "(", "singleMember", ".", "filterMatches", "(", "item", ")", ")", "{", "match", "=", "true", ";", "matchingMember", "=", "singleMember", ";", "}", "}", "// Otherwise we give all the members a chance to match it", "else", "{", "LocalQPConsumerKey", "keyMember", ";", "int", "index", ";", "int", "size", "=", "specificKeyMembers", ".", "size", "(", ")", ";", "for", "(", "index", "=", "0", ";", "(", "index", "<", "size", ")", "&&", "!", "match", ";", "index", "++", ")", "{", "keyMember", "=", "specificKeyMembers", ".", "get", "(", "index", ")", ";", "// Drop out if one of the members matches it", "if", "(", "keyMember", ".", "filterMatches", "(", "item", ")", ")", "{", "match", "=", "true", ";", "matchingMember", "=", "keyMember", ";", "}", "}", "}", "}", "// we only want to remember this result if get got here as a result of a consumer", "//asking for a message.", "boolean", "onConsumerThread", "=", "consumerThreadActive", "&&", "(", "Thread", ".", "currentThread", "(", ")", ".", "getId", "(", ")", "==", "consumerThreadID", ")", ";", "if", "(", "onConsumerThread", ")", "{", "currentMatch", "=", "match", ";", "currentMatchingMember", "=", "matchingMember", ";", "}", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "exit", "(", "tc", ",", "\"filterMatches\"", ",", "new", "Object", "[", "]", "{", "Boolean", ".", "valueOf", "(", "match", ")", ",", "matchingMember", "}", ")", ";", "return", "match", ";", "}" ]
All members of a keyGroup share the same getCursor on the itemStream, which uses this method to filter the items. This allows us to see if an item matches ANY of the members of the group.
[ "All", "members", "of", "a", "keyGroup", "share", "the", "same", "getCursor", "on", "the", "itemStream", "which", "uses", "this", "method", "to", "filter", "the", "items", ".", "This", "allows", "us", "to", "see", "if", "an", "item", "matches", "ANY", "of", "the", "members", "of", "the", "group", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/LocalQPConsumerKeyGroup.java#L850-L915
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/LocalQPConsumerKeyGroup.java
LocalQPConsumerKeyGroup.getMatchingMember
public ConsumableKey getMatchingMember(ConsumableKey preferedKey) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "getMatchingMember"); ConsumableKey key = null; // The last move of the getCursor found a match if(currentMatch) { // There was a general waiter so we'll try to use the preferred // member if(currentMatchingMember == null) { // We can only choose the preferred member if they are not specific if(!preferedKey.isSpecific()) key = preferedKey; else if(generalMemberCount > 0) key = resolvedKey(); } // The match was to a specific member, we much choose then else key = currentMatchingMember; } else { // There was no match if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "getMatchingMember", "SIErrorException"); throw new SIErrorException( nls.getFormattedMessage( "INTERNAL_MESSAGING_ERROR_CWSIP0001", new Object[] { "com.ibm.ws.sib.processor.impl.LocalQPConsumerKeyGroup", "1:982:1.6.1.14" }, null)); } // We shouldn't be here if we didn't get a match if(key == null) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "getMatchingMember", "SIErrorException"); throw new SIErrorException( nls.getFormattedMessage( "INTERNAL_MESSAGING_ERROR_CWSIP0001", new Object[] { "com.ibm.ws.sib.processor.impl.LocalQPConsumerKeyGroup", "1:995:1.6.1.14" }, null)); } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "getMatchingMember", key); return key; }
java
public ConsumableKey getMatchingMember(ConsumableKey preferedKey) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "getMatchingMember"); ConsumableKey key = null; // The last move of the getCursor found a match if(currentMatch) { // There was a general waiter so we'll try to use the preferred // member if(currentMatchingMember == null) { // We can only choose the preferred member if they are not specific if(!preferedKey.isSpecific()) key = preferedKey; else if(generalMemberCount > 0) key = resolvedKey(); } // The match was to a specific member, we much choose then else key = currentMatchingMember; } else { // There was no match if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "getMatchingMember", "SIErrorException"); throw new SIErrorException( nls.getFormattedMessage( "INTERNAL_MESSAGING_ERROR_CWSIP0001", new Object[] { "com.ibm.ws.sib.processor.impl.LocalQPConsumerKeyGroup", "1:982:1.6.1.14" }, null)); } // We shouldn't be here if we didn't get a match if(key == null) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "getMatchingMember", "SIErrorException"); throw new SIErrorException( nls.getFormattedMessage( "INTERNAL_MESSAGING_ERROR_CWSIP0001", new Object[] { "com.ibm.ws.sib.processor.impl.LocalQPConsumerKeyGroup", "1:995:1.6.1.14" }, null)); } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "getMatchingMember", key); return key; }
[ "public", "ConsumableKey", "getMatchingMember", "(", "ConsumableKey", "preferedKey", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "entry", "(", "tc", ",", "\"getMatchingMember\"", ")", ";", "ConsumableKey", "key", "=", "null", ";", "// The last move of the getCursor found a match", "if", "(", "currentMatch", ")", "{", "// There was a general waiter so we'll try to use the preferred", "// member", "if", "(", "currentMatchingMember", "==", "null", ")", "{", "// We can only choose the preferred member if they are not specific", "if", "(", "!", "preferedKey", ".", "isSpecific", "(", ")", ")", "key", "=", "preferedKey", ";", "else", "if", "(", "generalMemberCount", ">", "0", ")", "key", "=", "resolvedKey", "(", ")", ";", "}", "// The match was to a specific member, we much choose then", "else", "key", "=", "currentMatchingMember", ";", "}", "else", "{", "// There was no match", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "exit", "(", "tc", ",", "\"getMatchingMember\"", ",", "\"SIErrorException\"", ")", ";", "throw", "new", "SIErrorException", "(", "nls", ".", "getFormattedMessage", "(", "\"INTERNAL_MESSAGING_ERROR_CWSIP0001\"", ",", "new", "Object", "[", "]", "{", "\"com.ibm.ws.sib.processor.impl.LocalQPConsumerKeyGroup\"", ",", "\"1:982:1.6.1.14\"", "}", ",", "null", ")", ")", ";", "}", "// We shouldn't be here if we didn't get a match", "if", "(", "key", "==", "null", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "exit", "(", "tc", ",", "\"getMatchingMember\"", ",", "\"SIErrorException\"", ")", ";", "throw", "new", "SIErrorException", "(", "nls", ".", "getFormattedMessage", "(", "\"INTERNAL_MESSAGING_ERROR_CWSIP0001\"", ",", "new", "Object", "[", "]", "{", "\"com.ibm.ws.sib.processor.impl.LocalQPConsumerKeyGroup\"", ",", "\"1:995:1.6.1.14\"", "}", ",", "null", ")", ")", ";", "}", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "exit", "(", "tc", ",", "\"getMatchingMember\"", ",", "key", ")", ";", "return", "key", ";", "}" ]
Returns the member which last matched a message @param preferedKey @return
[ "Returns", "the", "member", "which", "last", "matched", "a", "message" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/LocalQPConsumerKeyGroup.java#L922-L976
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/LocalQPConsumerKeyGroup.java
LocalQPConsumerKeyGroup.attachMessage
public void attachMessage(ConsumableKey consumerKey) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { SibTr.entry(tc, "attachMessage", msgAttachedMember); SibTr.exit(tc, "attachMessage", consumerKey); } if(msgAttachedMember == null) msgAttachedMember = consumerKey; else { // We already have a message attached if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "attachMessage", "SIErrorException"); throw new SIErrorException( nls.getFormattedMessage( "INTERNAL_MESSAGING_ERROR_CWSIP0001", new Object[] { "com.ibm.ws.sib.processor.impl.LocalQPConsumerKeyGroup", "1:1027:1.6.1.14" }, null)); } }
java
public void attachMessage(ConsumableKey consumerKey) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { SibTr.entry(tc, "attachMessage", msgAttachedMember); SibTr.exit(tc, "attachMessage", consumerKey); } if(msgAttachedMember == null) msgAttachedMember = consumerKey; else { // We already have a message attached if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "attachMessage", "SIErrorException"); throw new SIErrorException( nls.getFormattedMessage( "INTERNAL_MESSAGING_ERROR_CWSIP0001", new Object[] { "com.ibm.ws.sib.processor.impl.LocalQPConsumerKeyGroup", "1:1027:1.6.1.14" }, null)); } }
[ "public", "void", "attachMessage", "(", "ConsumableKey", "consumerKey", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "{", "SibTr", ".", "entry", "(", "tc", ",", "\"attachMessage\"", ",", "msgAttachedMember", ")", ";", "SibTr", ".", "exit", "(", "tc", ",", "\"attachMessage\"", ",", "consumerKey", ")", ";", "}", "if", "(", "msgAttachedMember", "==", "null", ")", "msgAttachedMember", "=", "consumerKey", ";", "else", "{", "// We already have a message attached", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "exit", "(", "tc", ",", "\"attachMessage\"", ",", "\"SIErrorException\"", ")", ";", "throw", "new", "SIErrorException", "(", "nls", ".", "getFormattedMessage", "(", "\"INTERNAL_MESSAGING_ERROR_CWSIP0001\"", ",", "new", "Object", "[", "]", "{", "\"com.ibm.ws.sib.processor.impl.LocalQPConsumerKeyGroup\"", ",", "\"1:1027:1.6.1.14\"", "}", ",", "null", ")", ")", ";", "}", "}" ]
Record the fact that one of the members has a message attached @param consumerKey
[ "Record", "the", "fact", "that", "one", "of", "the", "members", "has", "a", "message", "attached" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/LocalQPConsumerKeyGroup.java#L982-L1003
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/LocalQPConsumerKeyGroup.java
LocalQPConsumerKeyGroup.hasNonSpecificConsumers
public boolean hasNonSpecificConsumers() { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "hasNonSpecificConsumers"); boolean value; if (generalMemberCount > 0) value = true; else value = false; if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "hasNonSpecificConsumers", Boolean.valueOf(value)); return value; }
java
public boolean hasNonSpecificConsumers() { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "hasNonSpecificConsumers"); boolean value; if (generalMemberCount > 0) value = true; else value = false; if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "hasNonSpecificConsumers", Boolean.valueOf(value)); return value; }
[ "public", "boolean", "hasNonSpecificConsumers", "(", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "entry", "(", "tc", ",", "\"hasNonSpecificConsumers\"", ")", ";", "boolean", "value", ";", "if", "(", "generalMemberCount", ">", "0", ")", "value", "=", "true", ";", "else", "value", "=", "false", ";", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "exit", "(", "tc", ",", "\"hasNonSpecificConsumers\"", ",", "Boolean", ".", "valueOf", "(", "value", ")", ")", ";", "return", "value", ";", "}" ]
Only called when consumer is ready and when already holding the ConsumerDispatchers readyConsumerPointLock @return
[ "Only", "called", "when", "consumer", "is", "ready", "and", "when", "already", "holding", "the", "ConsumerDispatchers", "readyConsumerPointLock" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/LocalQPConsumerKeyGroup.java#L1199-L1209
train
OpenLiberty/open-liberty
dev/com.ibm.ws.cloudant/src/com/ibm/ws/cloudant/CloudantDatabaseService.java
CloudantDatabaseService.createResource
@Override public Object createResource(ResourceInfo info) throws Exception { ComponentMetaData cData = ComponentMetaDataAccessorImpl.getComponentMetaDataAccessor().getComponentMetaData(); if (cData != null) applications.add(cData.getJ2EEName().getApplication()); return cloudantSvc.createResource( (String) props.get("databaseName"), (Boolean) props.get("create"), info == null ? ResourceInfo.AUTH_APPLICATION : info.getAuth(), info == null ? null : info.getLoginPropertyList()); }
java
@Override public Object createResource(ResourceInfo info) throws Exception { ComponentMetaData cData = ComponentMetaDataAccessorImpl.getComponentMetaDataAccessor().getComponentMetaData(); if (cData != null) applications.add(cData.getJ2EEName().getApplication()); return cloudantSvc.createResource( (String) props.get("databaseName"), (Boolean) props.get("create"), info == null ? ResourceInfo.AUTH_APPLICATION : info.getAuth(), info == null ? null : info.getLoginPropertyList()); }
[ "@", "Override", "public", "Object", "createResource", "(", "ResourceInfo", "info", ")", "throws", "Exception", "{", "ComponentMetaData", "cData", "=", "ComponentMetaDataAccessorImpl", ".", "getComponentMetaDataAccessor", "(", ")", ".", "getComponentMetaData", "(", ")", ";", "if", "(", "cData", "!=", "null", ")", "applications", ".", "add", "(", "cData", ".", "getJ2EEName", "(", ")", ".", "getApplication", "(", ")", ")", ";", "return", "cloudantSvc", ".", "createResource", "(", "(", "String", ")", "props", ".", "get", "(", "\"databaseName\"", ")", ",", "(", "Boolean", ")", "props", ".", "get", "(", "\"create\"", ")", ",", "info", "==", "null", "?", "ResourceInfo", ".", "AUTH_APPLICATION", ":", "info", ".", "getAuth", "(", ")", ",", "info", "==", "null", "?", "null", ":", "info", ".", "getLoginPropertyList", "(", ")", ")", ";", "}" ]
Invoked when a cloudant Database is injected or looked up. @param info resource ref info, or null if direct lookup. @return instance of com.cloudant.client.api.Database
[ "Invoked", "when", "a", "cloudant", "Database", "is", "injected", "or", "looked", "up", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.cloudant/src/com/ibm/ws/cloudant/CloudantDatabaseService.java#L64-L75
train
OpenLiberty/open-liberty
dev/com.ibm.ws.cloudant/src/com/ibm/ws/cloudant/CloudantDatabaseService.java
CloudantDatabaseService.getCloudantClient
public Object getCloudantClient(ResourceInfo info) throws Exception { return cloudantSvc.getCloudantClient( info == null ? ResourceInfo.AUTH_APPLICATION : info.getAuth(), info == null ? null : info.getLoginPropertyList()); }
java
public Object getCloudantClient(ResourceInfo info) throws Exception { return cloudantSvc.getCloudantClient( info == null ? ResourceInfo.AUTH_APPLICATION : info.getAuth(), info == null ? null : info.getLoginPropertyList()); }
[ "public", "Object", "getCloudantClient", "(", "ResourceInfo", "info", ")", "throws", "Exception", "{", "return", "cloudantSvc", ".", "getCloudantClient", "(", "info", "==", "null", "?", "ResourceInfo", ".", "AUTH_APPLICATION", ":", "info", ".", "getAuth", "(", ")", ",", "info", "==", "null", "?", "null", ":", "info", ".", "getLoginPropertyList", "(", ")", ")", ";", "}" ]
Returns the underlying cloudantClient object for this database and the provided resource config @param info The ResourceConfig used with the associated cloudantDatabase lookup @return the cloudantClient object, or null @throws Exception
[ "Returns", "the", "underlying", "cloudantClient", "object", "for", "this", "database", "and", "the", "provided", "resource", "config" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.cloudant/src/com/ibm/ws/cloudant/CloudantDatabaseService.java#L108-L112
train
OpenLiberty/open-liberty
dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/view/facelets/impl/DefaultFacelet.java
DefaultFacelet.getRelativePath
private URL getRelativePath(FacesContext facesContext, String path) throws IOException { URL url = (URL) _relativePaths.get(path); if (url == null) { url = _factory.resolveURL(facesContext, _src, path); if (url != null) { ViewResource viewResource = (ViewResource) facesContext.getAttributes().get( FaceletFactory.LAST_RESOURCE_RESOLVED); if (viewResource != null) { // If a view resource has been used to resolve a resource, the cache is in // the ResourceHandler implementation. No need to cache in _relativeLocations. } else { _relativePaths.put(path, url); } } } return url; }
java
private URL getRelativePath(FacesContext facesContext, String path) throws IOException { URL url = (URL) _relativePaths.get(path); if (url == null) { url = _factory.resolveURL(facesContext, _src, path); if (url != null) { ViewResource viewResource = (ViewResource) facesContext.getAttributes().get( FaceletFactory.LAST_RESOURCE_RESOLVED); if (viewResource != null) { // If a view resource has been used to resolve a resource, the cache is in // the ResourceHandler implementation. No need to cache in _relativeLocations. } else { _relativePaths.put(path, url); } } } return url; }
[ "private", "URL", "getRelativePath", "(", "FacesContext", "facesContext", ",", "String", "path", ")", "throws", "IOException", "{", "URL", "url", "=", "(", "URL", ")", "_relativePaths", ".", "get", "(", "path", ")", ";", "if", "(", "url", "==", "null", ")", "{", "url", "=", "_factory", ".", "resolveURL", "(", "facesContext", ",", "_src", ",", "path", ")", ";", "if", "(", "url", "!=", "null", ")", "{", "ViewResource", "viewResource", "=", "(", "ViewResource", ")", "facesContext", ".", "getAttributes", "(", ")", ".", "get", "(", "FaceletFactory", ".", "LAST_RESOURCE_RESOLVED", ")", ";", "if", "(", "viewResource", "!=", "null", ")", "{", "// If a view resource has been used to resolve a resource, the cache is in", "// the ResourceHandler implementation. No need to cache in _relativeLocations.", "}", "else", "{", "_relativePaths", ".", "put", "(", "path", ",", "url", ")", ";", "}", "}", "}", "return", "url", ";", "}" ]
Delegates resolution to DefaultFaceletFactory reference. Also, caches URLs for relative paths. @param path a relative url path @return URL pointing to destination @throws IOException if there is a problem creating the URL for the path specified
[ "Delegates", "resolution", "to", "DefaultFaceletFactory", "reference", ".", "Also", "caches", "URLs", "for", "relative", "paths", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/view/facelets/impl/DefaultFacelet.java#L470-L492
train
OpenLiberty/open-liberty
dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/view/facelets/impl/DefaultFacelet.java
DefaultFacelet.include
private void include(AbstractFaceletContext ctx, UIComponent parent) throws IOException, FacesException, FaceletException, ELException { ctx.pushPageContext(new PageContextImpl()); try { this.refresh(parent); DefaultFaceletContext ctxWrapper = new DefaultFaceletContext((DefaultFaceletContext)ctx, this, false); ctx.getFacesContext().getAttributes().put(FaceletContext.FACELET_CONTEXT_KEY, ctxWrapper); _root.apply(ctxWrapper, parent); ctx.getFacesContext().getAttributes().put(FaceletContext.FACELET_CONTEXT_KEY, ctx); this.markApplied(parent); } finally { ctx.popPageContext(); } }
java
private void include(AbstractFaceletContext ctx, UIComponent parent) throws IOException, FacesException, FaceletException, ELException { ctx.pushPageContext(new PageContextImpl()); try { this.refresh(parent); DefaultFaceletContext ctxWrapper = new DefaultFaceletContext((DefaultFaceletContext)ctx, this, false); ctx.getFacesContext().getAttributes().put(FaceletContext.FACELET_CONTEXT_KEY, ctxWrapper); _root.apply(ctxWrapper, parent); ctx.getFacesContext().getAttributes().put(FaceletContext.FACELET_CONTEXT_KEY, ctx); this.markApplied(parent); } finally { ctx.popPageContext(); } }
[ "private", "void", "include", "(", "AbstractFaceletContext", "ctx", ",", "UIComponent", "parent", ")", "throws", "IOException", ",", "FacesException", ",", "FaceletException", ",", "ELException", "{", "ctx", ".", "pushPageContext", "(", "new", "PageContextImpl", "(", ")", ")", ";", "try", "{", "this", ".", "refresh", "(", "parent", ")", ";", "DefaultFaceletContext", "ctxWrapper", "=", "new", "DefaultFaceletContext", "(", "(", "DefaultFaceletContext", ")", "ctx", ",", "this", ",", "false", ")", ";", "ctx", ".", "getFacesContext", "(", ")", ".", "getAttributes", "(", ")", ".", "put", "(", "FaceletContext", ".", "FACELET_CONTEXT_KEY", ",", "ctxWrapper", ")", ";", "_root", ".", "apply", "(", "ctxWrapper", ",", "parent", ")", ";", "ctx", ".", "getFacesContext", "(", ")", ".", "getAttributes", "(", ")", ".", "put", "(", "FaceletContext", ".", "FACELET_CONTEXT_KEY", ",", "ctx", ")", ";", "this", ".", "markApplied", "(", "parent", ")", ";", "}", "finally", "{", "ctx", ".", "popPageContext", "(", ")", ";", "}", "}" ]
Given the passed FaceletContext, apply our child FaceletHandlers to the passed parent @see FaceletHandler#apply(FaceletContext, UIComponent) @param ctx the FaceletContext to use for applying our FaceletHandlers @param parent the parent component to apply changes to @throws IOException @throws FacesException @throws FaceletException @throws ELException
[ "Given", "the", "passed", "FaceletContext", "apply", "our", "child", "FaceletHandlers", "to", "the", "passed", "parent" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/view/facelets/impl/DefaultFacelet.java#L517-L534
train
OpenLiberty/open-liberty
dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/view/facelets/impl/DefaultFacelet.java
DefaultFacelet.include
public void include(AbstractFaceletContext ctx, UIComponent parent, URL url) throws IOException, FacesException, FaceletException, ELException { DefaultFacelet f = (DefaultFacelet) _factory.getFacelet(ctx, url); f.include(ctx, parent); }
java
public void include(AbstractFaceletContext ctx, UIComponent parent, URL url) throws IOException, FacesException, FaceletException, ELException { DefaultFacelet f = (DefaultFacelet) _factory.getFacelet(ctx, url); f.include(ctx, parent); }
[ "public", "void", "include", "(", "AbstractFaceletContext", "ctx", ",", "UIComponent", "parent", ",", "URL", "url", ")", "throws", "IOException", ",", "FacesException", ",", "FaceletException", ",", "ELException", "{", "DefaultFacelet", "f", "=", "(", "DefaultFacelet", ")", "_factory", ".", "getFacelet", "(", "ctx", ",", "url", ")", ";", "f", ".", "include", "(", "ctx", ",", "parent", ")", ";", "}" ]
Grabs a DefaultFacelet from referenced DefaultFaceletFacotry @see DefaultFaceletFactory#getFacelet(URL) @param ctx FaceletContext to pass to the included Facelet @param parent UIComponent to apply changes to @param url URL source to include Facelet from @throws IOException @throws FacesException @throws FaceletException @throws ELException
[ "Grabs", "a", "DefaultFacelet", "from", "referenced", "DefaultFaceletFacotry" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/view/facelets/impl/DefaultFacelet.java#L576-L581
train
OpenLiberty/open-liberty
dev/com.ibm.ws.injection.core/src/com/ibm/ws/injectionengine/ReferenceContextImpl.java
ReferenceContextImpl.process
@Override public synchronized void process() throws InjectionException { final boolean isTraceOn = TraceComponent.isAnyTracingEnabled(); if (isTraceOn && tc.isEntryEnabled()) Tr.entry(tc, "process: " + this); // ------------------------------------------------------------------- // Determine if it's valid to process the instance or not. // ------------------------------------------------------------------- if (isAlreadyProcessed) { if (ivProcessFailure != null) { if (isTraceOn && tc.isEntryEnabled()) Tr.exit(tc, "rethrowing " + ivProcessFailure); throw new InjectionException(ivProcessFailure.getMessage(), ivProcessFailure); } if (isTraceOn && tc.isEntryEnabled()) Tr.exit(tc, "No-opping the .process() method because this ReferenceContext " + "instance has already been processed."); return; } if (ivProviders.isEmpty()) { throw new IllegalStateException("Unable to perform reference processing. " + "The list of input components was empty."); } boolean complete = false; try { processImpl(); complete = true; } catch (InjectionException ex) { ivProcessFailure = ex; complete = true; if (isTraceOn && tc.isEntryEnabled()) Tr.exit(tc, "process: " + ex); throw ex; } finally { if (complete) { // Ensure that we only attempt processing once. This will avoid redundant // work, and will also ensure ComponentNameSpaceConfigurationProvider is // only called once. isAlreadyProcessed = true; // F743-17630CodRv // Remove input objects from memory as they are no longer needed. // Keep output data structures around, since they need to be retrieved // by the various containers at unknown point in the future. ivProviders.clear(); } } if (isTraceOn && tc.isEntryEnabled()) Tr.exit(tc, "process"); }
java
@Override public synchronized void process() throws InjectionException { final boolean isTraceOn = TraceComponent.isAnyTracingEnabled(); if (isTraceOn && tc.isEntryEnabled()) Tr.entry(tc, "process: " + this); // ------------------------------------------------------------------- // Determine if it's valid to process the instance or not. // ------------------------------------------------------------------- if (isAlreadyProcessed) { if (ivProcessFailure != null) { if (isTraceOn && tc.isEntryEnabled()) Tr.exit(tc, "rethrowing " + ivProcessFailure); throw new InjectionException(ivProcessFailure.getMessage(), ivProcessFailure); } if (isTraceOn && tc.isEntryEnabled()) Tr.exit(tc, "No-opping the .process() method because this ReferenceContext " + "instance has already been processed."); return; } if (ivProviders.isEmpty()) { throw new IllegalStateException("Unable to perform reference processing. " + "The list of input components was empty."); } boolean complete = false; try { processImpl(); complete = true; } catch (InjectionException ex) { ivProcessFailure = ex; complete = true; if (isTraceOn && tc.isEntryEnabled()) Tr.exit(tc, "process: " + ex); throw ex; } finally { if (complete) { // Ensure that we only attempt processing once. This will avoid redundant // work, and will also ensure ComponentNameSpaceConfigurationProvider is // only called once. isAlreadyProcessed = true; // F743-17630CodRv // Remove input objects from memory as they are no longer needed. // Keep output data structures around, since they need to be retrieved // by the various containers at unknown point in the future. ivProviders.clear(); } } if (isTraceOn && tc.isEntryEnabled()) Tr.exit(tc, "process"); }
[ "@", "Override", "public", "synchronized", "void", "process", "(", ")", "throws", "InjectionException", "{", "final", "boolean", "isTraceOn", "=", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", ";", "if", "(", "isTraceOn", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "Tr", ".", "entry", "(", "tc", ",", "\"process: \"", "+", "this", ")", ";", "// -------------------------------------------------------------------", "// Determine if it's valid to process the instance or not.", "// -------------------------------------------------------------------", "if", "(", "isAlreadyProcessed", ")", "{", "if", "(", "ivProcessFailure", "!=", "null", ")", "{", "if", "(", "isTraceOn", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "Tr", ".", "exit", "(", "tc", ",", "\"rethrowing \"", "+", "ivProcessFailure", ")", ";", "throw", "new", "InjectionException", "(", "ivProcessFailure", ".", "getMessage", "(", ")", ",", "ivProcessFailure", ")", ";", "}", "if", "(", "isTraceOn", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "Tr", ".", "exit", "(", "tc", ",", "\"No-opping the .process() method because this ReferenceContext \"", "+", "\"instance has already been processed.\"", ")", ";", "return", ";", "}", "if", "(", "ivProviders", ".", "isEmpty", "(", ")", ")", "{", "throw", "new", "IllegalStateException", "(", "\"Unable to perform reference processing. \"", "+", "\"The list of input components was empty.\"", ")", ";", "}", "boolean", "complete", "=", "false", ";", "try", "{", "processImpl", "(", ")", ";", "complete", "=", "true", ";", "}", "catch", "(", "InjectionException", "ex", ")", "{", "ivProcessFailure", "=", "ex", ";", "complete", "=", "true", ";", "if", "(", "isTraceOn", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "Tr", ".", "exit", "(", "tc", ",", "\"process: \"", "+", "ex", ")", ";", "throw", "ex", ";", "}", "finally", "{", "if", "(", "complete", ")", "{", "// Ensure that we only attempt processing once. This will avoid redundant", "// work, and will also ensure ComponentNameSpaceConfigurationProvider is", "// only called once.", "isAlreadyProcessed", "=", "true", ";", "// F743-17630CodRv", "// Remove input objects from memory as they are no longer needed.", "// Keep output data structures around, since they need to be retrieved", "// by the various containers at unknown point in the future.", "ivProviders", ".", "clear", "(", ")", ";", "}", "}", "if", "(", "isTraceOn", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "Tr", ".", "exit", "(", "tc", ",", "\"process\"", ")", ";", "}" ]
F743-17630CodRv
[ "F743", "-", "17630CodRv" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.injection.core/src/com/ibm/ws/injectionengine/ReferenceContextImpl.java#L257-L312
train
OpenLiberty/open-liberty
dev/com.ibm.ws.injection.core/src/com/ibm/ws/injectionengine/ReferenceContextImpl.java
ReferenceContextImpl.createPersistenceMaps
private void createPersistenceMaps(ComponentNameSpaceConfiguration masterCompNSConfig, List<ComponentNameSpaceConfiguration> compNSConfigs) { Map<Class<?>, Collection<String>> classesToComponents = new HashMap<Class<?>, Collection<String>>(); Map<String, Collection<String>> persistenceRefsToComponents = new HashMap<String, Collection<String>>(); for (ComponentNameSpaceConfiguration compNSConfig : compNSConfigs) { ComponentMetaData cmd = compNSConfig.getComponentMetaData(); if (cmd != null) { String name = cmd.getJ2EEName().getComponent(); if (!compNSConfig.isMetaDataComplete()) { List<Class<?>> classesToScan = compNSConfig.getInjectionClasses(); if (classesToScan != null) { for (Class<?> klass : classesToScan) { for (Class<?> superClass = klass; superClass != null && superClass != Object.class; superClass = superClass.getSuperclass()) { addComponentToPersistenceMap(classesToComponents, superClass, name); } } } } List<? extends PersistenceContextRef> pcRefs = compNSConfig.getPersistenceContextRefs(); if (pcRefs != null) { for (PersistenceContextRef ref : pcRefs) { addComponentToPersistenceMap(persistenceRefsToComponents, ref.getName(), name); } } List<? extends PersistenceUnitRef> puRefs = compNSConfig.getPersistenceUnitRefs(); if (puRefs != null) { for (PersistenceUnitRef ref : puRefs) { addComponentToPersistenceMap(persistenceRefsToComponents, ref.getName(), name); } } } } masterCompNSConfig.setPersistenceMaps(classesToComponents, persistenceRefsToComponents); }
java
private void createPersistenceMaps(ComponentNameSpaceConfiguration masterCompNSConfig, List<ComponentNameSpaceConfiguration> compNSConfigs) { Map<Class<?>, Collection<String>> classesToComponents = new HashMap<Class<?>, Collection<String>>(); Map<String, Collection<String>> persistenceRefsToComponents = new HashMap<String, Collection<String>>(); for (ComponentNameSpaceConfiguration compNSConfig : compNSConfigs) { ComponentMetaData cmd = compNSConfig.getComponentMetaData(); if (cmd != null) { String name = cmd.getJ2EEName().getComponent(); if (!compNSConfig.isMetaDataComplete()) { List<Class<?>> classesToScan = compNSConfig.getInjectionClasses(); if (classesToScan != null) { for (Class<?> klass : classesToScan) { for (Class<?> superClass = klass; superClass != null && superClass != Object.class; superClass = superClass.getSuperclass()) { addComponentToPersistenceMap(classesToComponents, superClass, name); } } } } List<? extends PersistenceContextRef> pcRefs = compNSConfig.getPersistenceContextRefs(); if (pcRefs != null) { for (PersistenceContextRef ref : pcRefs) { addComponentToPersistenceMap(persistenceRefsToComponents, ref.getName(), name); } } List<? extends PersistenceUnitRef> puRefs = compNSConfig.getPersistenceUnitRefs(); if (puRefs != null) { for (PersistenceUnitRef ref : puRefs) { addComponentToPersistenceMap(persistenceRefsToComponents, ref.getName(), name); } } } } masterCompNSConfig.setPersistenceMaps(classesToComponents, persistenceRefsToComponents); }
[ "private", "void", "createPersistenceMaps", "(", "ComponentNameSpaceConfiguration", "masterCompNSConfig", ",", "List", "<", "ComponentNameSpaceConfiguration", ">", "compNSConfigs", ")", "{", "Map", "<", "Class", "<", "?", ">", ",", "Collection", "<", "String", ">", ">", "classesToComponents", "=", "new", "HashMap", "<", "Class", "<", "?", ">", ",", "Collection", "<", "String", ">", ">", "(", ")", ";", "Map", "<", "String", ",", "Collection", "<", "String", ">", ">", "persistenceRefsToComponents", "=", "new", "HashMap", "<", "String", ",", "Collection", "<", "String", ">", ">", "(", ")", ";", "for", "(", "ComponentNameSpaceConfiguration", "compNSConfig", ":", "compNSConfigs", ")", "{", "ComponentMetaData", "cmd", "=", "compNSConfig", ".", "getComponentMetaData", "(", ")", ";", "if", "(", "cmd", "!=", "null", ")", "{", "String", "name", "=", "cmd", ".", "getJ2EEName", "(", ")", ".", "getComponent", "(", ")", ";", "if", "(", "!", "compNSConfig", ".", "isMetaDataComplete", "(", ")", ")", "{", "List", "<", "Class", "<", "?", ">", ">", "classesToScan", "=", "compNSConfig", ".", "getInjectionClasses", "(", ")", ";", "if", "(", "classesToScan", "!=", "null", ")", "{", "for", "(", "Class", "<", "?", ">", "klass", ":", "classesToScan", ")", "{", "for", "(", "Class", "<", "?", ">", "superClass", "=", "klass", ";", "superClass", "!=", "null", "&&", "superClass", "!=", "Object", ".", "class", ";", "superClass", "=", "superClass", ".", "getSuperclass", "(", ")", ")", "{", "addComponentToPersistenceMap", "(", "classesToComponents", ",", "superClass", ",", "name", ")", ";", "}", "}", "}", "}", "List", "<", "?", "extends", "PersistenceContextRef", ">", "pcRefs", "=", "compNSConfig", ".", "getPersistenceContextRefs", "(", ")", ";", "if", "(", "pcRefs", "!=", "null", ")", "{", "for", "(", "PersistenceContextRef", "ref", ":", "pcRefs", ")", "{", "addComponentToPersistenceMap", "(", "persistenceRefsToComponents", ",", "ref", ".", "getName", "(", ")", ",", "name", ")", ";", "}", "}", "List", "<", "?", "extends", "PersistenceUnitRef", ">", "puRefs", "=", "compNSConfig", ".", "getPersistenceUnitRefs", "(", ")", ";", "if", "(", "puRefs", "!=", "null", ")", "{", "for", "(", "PersistenceUnitRef", "ref", ":", "puRefs", ")", "{", "addComponentToPersistenceMap", "(", "persistenceRefsToComponents", ",", "ref", ".", "getName", "(", ")", ",", "name", ")", ";", "}", "}", "}", "}", "masterCompNSConfig", ".", "setPersistenceMaps", "(", "classesToComponents", ",", "persistenceRefsToComponents", ")", ";", "}" ]
F743-30682
[ "F743", "-", "30682" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.injection.core/src/com/ibm/ws/injectionengine/ReferenceContextImpl.java#L637-L675
train
OpenLiberty/open-liberty
dev/com.ibm.ws.injection.core/src/com/ibm/ws/injectionengine/ReferenceContextImpl.java
ReferenceContextImpl.dumpJavaColonCompEnvMap
private String dumpJavaColonCompEnvMap() { StringBuffer buffer = new StringBuffer(""); buffer.append("EJBContext.lookup data structure contents:\n"); buffer.append(" Contains **" + ivJavaColonCompEnvMap.size() + "** bindings.\n"); if (!ivJavaColonCompEnvMap.isEmpty()) { Set<Map.Entry<String, InjectionBinding<?>>> entries = ivJavaColonCompEnvMap.entrySet(); Iterator<Map.Entry<String, InjectionBinding<?>>> entryIterator = entries.iterator(); int count = 0; while (entryIterator.hasNext()) { Map.Entry<String, InjectionBinding<?>> oneEntry = entryIterator.next(); buffer.append(" Entry " + count + "\n"); buffer.append(" Key: **" + oneEntry.getKey() + "**\n"); buffer.append(" Value: **" + oneEntry.getValue() + "**\n"); buffer.append("\n"); count++; } } return buffer.toString(); }
java
private String dumpJavaColonCompEnvMap() { StringBuffer buffer = new StringBuffer(""); buffer.append("EJBContext.lookup data structure contents:\n"); buffer.append(" Contains **" + ivJavaColonCompEnvMap.size() + "** bindings.\n"); if (!ivJavaColonCompEnvMap.isEmpty()) { Set<Map.Entry<String, InjectionBinding<?>>> entries = ivJavaColonCompEnvMap.entrySet(); Iterator<Map.Entry<String, InjectionBinding<?>>> entryIterator = entries.iterator(); int count = 0; while (entryIterator.hasNext()) { Map.Entry<String, InjectionBinding<?>> oneEntry = entryIterator.next(); buffer.append(" Entry " + count + "\n"); buffer.append(" Key: **" + oneEntry.getKey() + "**\n"); buffer.append(" Value: **" + oneEntry.getValue() + "**\n"); buffer.append("\n"); count++; } } return buffer.toString(); }
[ "private", "String", "dumpJavaColonCompEnvMap", "(", ")", "{", "StringBuffer", "buffer", "=", "new", "StringBuffer", "(", "\"\"", ")", ";", "buffer", ".", "append", "(", "\"EJBContext.lookup data structure contents:\\n\"", ")", ";", "buffer", ".", "append", "(", "\" Contains **\"", "+", "ivJavaColonCompEnvMap", ".", "size", "(", ")", "+", "\"** bindings.\\n\"", ")", ";", "if", "(", "!", "ivJavaColonCompEnvMap", ".", "isEmpty", "(", ")", ")", "{", "Set", "<", "Map", ".", "Entry", "<", "String", ",", "InjectionBinding", "<", "?", ">", ">", ">", "entries", "=", "ivJavaColonCompEnvMap", ".", "entrySet", "(", ")", ";", "Iterator", "<", "Map", ".", "Entry", "<", "String", ",", "InjectionBinding", "<", "?", ">", ">", ">", "entryIterator", "=", "entries", ".", "iterator", "(", ")", ";", "int", "count", "=", "0", ";", "while", "(", "entryIterator", ".", "hasNext", "(", ")", ")", "{", "Map", ".", "Entry", "<", "String", ",", "InjectionBinding", "<", "?", ">", ">", "oneEntry", "=", "entryIterator", ".", "next", "(", ")", ";", "buffer", ".", "append", "(", "\" Entry \"", "+", "count", "+", "\"\\n\"", ")", ";", "buffer", ".", "append", "(", "\" Key: **\"", "+", "oneEntry", ".", "getKey", "(", ")", "+", "\"**\\n\"", ")", ";", "buffer", ".", "append", "(", "\" Value: **\"", "+", "oneEntry", ".", "getValue", "(", ")", "+", "\"**\\n\"", ")", ";", "buffer", ".", "append", "(", "\"\\n\"", ")", ";", "count", "++", ";", "}", "}", "return", "buffer", ".", "toString", "(", ")", ";", "}" ]
Provides nice looking trace output for the EJBContext.lookup data structure.
[ "Provides", "nice", "looking", "trace", "output", "for", "the", "EJBContext", ".", "lookup", "data", "structure", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.injection.core/src/com/ibm/ws/injectionengine/ReferenceContextImpl.java#L691-L709
train
OpenLiberty/open-liberty
dev/com.ibm.ws.injection.core/src/com/ibm/ws/injectionengine/ReferenceContextImpl.java
ReferenceContextImpl.isProcessDynamicNeeded
@Override public boolean isProcessDynamicNeeded(List<Class<?>> injectionClasses) { for (Class<?> klass : injectionClasses) { if (!ivProcessedInjectionClasses.contains(klass)) { return true; } } return false; }
java
@Override public boolean isProcessDynamicNeeded(List<Class<?>> injectionClasses) { for (Class<?> klass : injectionClasses) { if (!ivProcessedInjectionClasses.contains(klass)) { return true; } } return false; }
[ "@", "Override", "public", "boolean", "isProcessDynamicNeeded", "(", "List", "<", "Class", "<", "?", ">", ">", "injectionClasses", ")", "{", "for", "(", "Class", "<", "?", ">", "klass", ":", "injectionClasses", ")", "{", "if", "(", "!", "ivProcessedInjectionClasses", ".", "contains", "(", "klass", ")", ")", "{", "return", "true", ";", "}", "}", "return", "false", ";", "}" ]
Returns true if dynamic processing is needed for any of the classes.
[ "Returns", "true", "if", "dynamic", "processing", "is", "needed", "for", "any", "of", "the", "classes", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.injection.core/src/com/ibm/ws/injectionengine/ReferenceContextImpl.java#L989-L998
train
OpenLiberty/open-liberty
dev/com.ibm.ws.kernel.feature.core/src/com/ibm/ws/kernel/feature/internal/subsystem/KernelFeatureDefinitionImpl.java
KernelFeatureDefinitionImpl.getKernelFeatures
public static List<ProvisioningFeatureDefinition> getKernelFeatures(BundleContext ctx, WsLocationAdmin locationService) { List<ProvisioningFeatureDefinition> result = kernelDefs; if (result == null) { result = kernelDefs = getKernelFeatures(ctx, locationService, false); } return result; }
java
public static List<ProvisioningFeatureDefinition> getKernelFeatures(BundleContext ctx, WsLocationAdmin locationService) { List<ProvisioningFeatureDefinition> result = kernelDefs; if (result == null) { result = kernelDefs = getKernelFeatures(ctx, locationService, false); } return result; }
[ "public", "static", "List", "<", "ProvisioningFeatureDefinition", ">", "getKernelFeatures", "(", "BundleContext", "ctx", ",", "WsLocationAdmin", "locationService", ")", "{", "List", "<", "ProvisioningFeatureDefinition", ">", "result", "=", "kernelDefs", ";", "if", "(", "result", "==", "null", ")", "{", "result", "=", "kernelDefs", "=", "getKernelFeatures", "(", "ctx", ",", "locationService", ",", "false", ")", ";", "}", "return", "result", ";", "}" ]
Get the kernel feature definitions in use by the runtime. Note: the kernel feature does not live in a standard repository location. It will never be found while iterating over a collection of resources. @param ctx @param locationService @return
[ "Get", "the", "kernel", "feature", "definitions", "in", "use", "by", "the", "runtime", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.kernel.feature.core/src/com/ibm/ws/kernel/feature/internal/subsystem/KernelFeatureDefinitionImpl.java#L61-L67
train
OpenLiberty/open-liberty
dev/com.ibm.ws.microprofile.openapi_fat/fat/src/com/ibm/ws/microprofile/openapi/fat/utils/OpenAPIConnection.java
OpenAPIConnection.download
public String download() { try { HttpURLConnection conn = getConnection(); return readConnection(conn); } catch (Exception e) { Assert.fail(e.getMessage()); } return null; }
java
public String download() { try { HttpURLConnection conn = getConnection(); return readConnection(conn); } catch (Exception e) { Assert.fail(e.getMessage()); } return null; }
[ "public", "String", "download", "(", ")", "{", "try", "{", "HttpURLConnection", "conn", "=", "getConnection", "(", ")", ";", "return", "readConnection", "(", "conn", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "Assert", ".", "fail", "(", "e", ".", "getMessage", "(", ")", ")", ";", "}", "return", "null", ";", "}" ]
Downloads contents of URL and converts them to a string @return string containing contents of a url
[ "Downloads", "contents", "of", "URL", "and", "converts", "them", "to", "a", "string" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.microprofile.openapi_fat/fat/src/com/ibm/ws/microprofile/openapi/fat/utils/OpenAPIConnection.java#L97-L107
train
OpenLiberty/open-liberty
dev/com.ibm.ws.microprofile.openapi_fat/fat/src/com/ibm/ws/microprofile/openapi/fat/utils/OpenAPIConnection.java
OpenAPIConnection.downloadModel
public OpenAPI downloadModel() throws Exception { String download = download(); if (download != null) { try { SwaggerParseResult parseResult = new OpenAPIParser().readContents(download, null, null, null); if (parseResult != null) { return parseResult.getOpenAPI(); } } catch (Exception e) { Assert.fail(e.getMessage()); } return null; } return null; }
java
public OpenAPI downloadModel() throws Exception { String download = download(); if (download != null) { try { SwaggerParseResult parseResult = new OpenAPIParser().readContents(download, null, null, null); if (parseResult != null) { return parseResult.getOpenAPI(); } } catch (Exception e) { Assert.fail(e.getMessage()); } return null; } return null; }
[ "public", "OpenAPI", "downloadModel", "(", ")", "throws", "Exception", "{", "String", "download", "=", "download", "(", ")", ";", "if", "(", "download", "!=", "null", ")", "{", "try", "{", "SwaggerParseResult", "parseResult", "=", "new", "OpenAPIParser", "(", ")", ".", "readContents", "(", "download", ",", "null", ",", "null", ",", "null", ")", ";", "if", "(", "parseResult", "!=", "null", ")", "{", "return", "parseResult", ".", "getOpenAPI", "(", ")", ";", "}", "}", "catch", "(", "Exception", "e", ")", "{", "Assert", ".", "fail", "(", "e", ".", "getMessage", "(", ")", ")", ";", "}", "return", "null", ";", "}", "return", "null", ";", "}" ]
Downloads contents of URL and converts them to an OpenAPI model @return an OpenAPI model
[ "Downloads", "contents", "of", "URL", "and", "converts", "them", "to", "an", "OpenAPI", "model" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.microprofile.openapi_fat/fat/src/com/ibm/ws/microprofile/openapi/fat/utils/OpenAPIConnection.java#L114-L128
train
OpenLiberty/open-liberty
dev/com.ibm.ws.microprofile.openapi_fat/fat/src/com/ibm/ws/microprofile/openapi/fat/utils/OpenAPIConnection.java
OpenAPIConnection.openAPIDocsConnection
public static OpenAPIConnection openAPIDocsConnection(LibertyServer server, boolean secure) { return new OpenAPIConnection(server, OPEN_API_DOCS).secure(secure); }
java
public static OpenAPIConnection openAPIDocsConnection(LibertyServer server, boolean secure) { return new OpenAPIConnection(server, OPEN_API_DOCS).secure(secure); }
[ "public", "static", "OpenAPIConnection", "openAPIDocsConnection", "(", "LibertyServer", "server", ",", "boolean", "secure", ")", "{", "return", "new", "OpenAPIConnection", "(", "server", ",", "OPEN_API_DOCS", ")", ".", "secure", "(", "secure", ")", ";", "}" ]
creates default connection for OpenAPI docs endpoint @param server - server to connect to @param secure - if true connection uses HTTPS @return
[ "creates", "default", "connection", "for", "OpenAPI", "docs", "endpoint" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.microprofile.openapi_fat/fat/src/com/ibm/ws/microprofile/openapi/fat/utils/OpenAPIConnection.java#L270-L272
train
OpenLiberty/open-liberty
dev/com.ibm.ws.microprofile.openapi_fat/fat/src/com/ibm/ws/microprofile/openapi/fat/utils/OpenAPIConnection.java
OpenAPIConnection.openAPIUIConnection
public static OpenAPIConnection openAPIUIConnection(LibertyServer server, boolean secure) { return new OpenAPIConnection(server, OPEN_API_UI).secure(secure); }
java
public static OpenAPIConnection openAPIUIConnection(LibertyServer server, boolean secure) { return new OpenAPIConnection(server, OPEN_API_UI).secure(secure); }
[ "public", "static", "OpenAPIConnection", "openAPIUIConnection", "(", "LibertyServer", "server", ",", "boolean", "secure", ")", "{", "return", "new", "OpenAPIConnection", "(", "server", ",", "OPEN_API_UI", ")", ".", "secure", "(", "secure", ")", ";", "}" ]
creates default connection for OpenAPI UI endpoint @param server - server to connect to @param secure - if true connection uses HTTPS @return
[ "creates", "default", "connection", "for", "OpenAPI", "UI", "endpoint" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.microprofile.openapi_fat/fat/src/com/ibm/ws/microprofile/openapi/fat/utils/OpenAPIConnection.java#L281-L283
train
OpenLiberty/open-liberty
dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/CacheEntry.java
CacheEntry.processDrsInbound
public void processDrsInbound(long localClock) { // Is dsrClock timestamp from the remote machine missing // or was the CE's timestampls already altered? if (drsClock <= 0) { return; } // Adjust timestamps for this machines clock. long clockDifference = localClock - drsClock; if (expirationTime > 0) expirationTime += clockDifference; if (timeStamp > 0) timeStamp += clockDifference; // Don't allow >1 time alter on this CE. drsClock = -1; }
java
public void processDrsInbound(long localClock) { // Is dsrClock timestamp from the remote machine missing // or was the CE's timestampls already altered? if (drsClock <= 0) { return; } // Adjust timestamps for this machines clock. long clockDifference = localClock - drsClock; if (expirationTime > 0) expirationTime += clockDifference; if (timeStamp > 0) timeStamp += clockDifference; // Don't allow >1 time alter on this CE. drsClock = -1; }
[ "public", "void", "processDrsInbound", "(", "long", "localClock", ")", "{", "// Is dsrClock timestamp from the remote machine missing", "// or was the CE's timestampls already altered?", "if", "(", "drsClock", "<=", "0", ")", "{", "return", ";", "}", "// Adjust timestamps for this machines clock.", "long", "clockDifference", "=", "localClock", "-", "drsClock", ";", "if", "(", "expirationTime", ">", "0", ")", "expirationTime", "+=", "clockDifference", ";", "if", "(", "timeStamp", ">", "0", ")", "timeStamp", "+=", "clockDifference", ";", "// Don't allow >1 time alter on this CE.", "drsClock", "=", "-", "1", ";", "}" ]
Handle needed processing after receiving a CE from a remote mahine via DRS. (1) Adjust the timestamps on an incomming CE to try and account for clock delta between machines.
[ "Handle", "needed", "processing", "after", "receiving", "a", "CE", "from", "a", "remote", "mahine", "via", "DRS", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/CacheEntry.java#L407-L421
train
OpenLiberty/open-liberty
dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/CacheEntry.java
CacheEntry.getValue
@Override public synchronized Object getValue() { if (id != null) { if (serializedValue != null) { long oldSize = -1; if (cacheEntryPool != null) { if (cacheEntryPool.cache.isCacheSizeInMBEnabled()) { oldSize = getObjectSize(); } } try { value = SerializationUtility.deserialize(serializedValue, cacheName); } catch (Exception ex) { com.ibm.ws.ffdc.FFDCFilter.processException(ex, "com.ibm.ws.cache.CacheEntry.getValue", "200", this); } if (value != null) { serializedValue = null; if (cacheEntryPool != null) { if (cacheEntryPool.cache.isCacheSizeInMBEnabled()) { long newSize = getObjectSize(); if (oldSize != -1 && newSize != -1) { cacheEntryPool.cache.increaseCacheSizeInBytes(newSize - oldSize, "GET_VALUE"); } else { cacheEntryPool.cache.disableCacheSizeInMB(); } } } } } } return value; }
java
@Override public synchronized Object getValue() { if (id != null) { if (serializedValue != null) { long oldSize = -1; if (cacheEntryPool != null) { if (cacheEntryPool.cache.isCacheSizeInMBEnabled()) { oldSize = getObjectSize(); } } try { value = SerializationUtility.deserialize(serializedValue, cacheName); } catch (Exception ex) { com.ibm.ws.ffdc.FFDCFilter.processException(ex, "com.ibm.ws.cache.CacheEntry.getValue", "200", this); } if (value != null) { serializedValue = null; if (cacheEntryPool != null) { if (cacheEntryPool.cache.isCacheSizeInMBEnabled()) { long newSize = getObjectSize(); if (oldSize != -1 && newSize != -1) { cacheEntryPool.cache.increaseCacheSizeInBytes(newSize - oldSize, "GET_VALUE"); } else { cacheEntryPool.cache.disableCacheSizeInMB(); } } } } } } return value; }
[ "@", "Override", "public", "synchronized", "Object", "getValue", "(", ")", "{", "if", "(", "id", "!=", "null", ")", "{", "if", "(", "serializedValue", "!=", "null", ")", "{", "long", "oldSize", "=", "-", "1", ";", "if", "(", "cacheEntryPool", "!=", "null", ")", "{", "if", "(", "cacheEntryPool", ".", "cache", ".", "isCacheSizeInMBEnabled", "(", ")", ")", "{", "oldSize", "=", "getObjectSize", "(", ")", ";", "}", "}", "try", "{", "value", "=", "SerializationUtility", ".", "deserialize", "(", "serializedValue", ",", "cacheName", ")", ";", "}", "catch", "(", "Exception", "ex", ")", "{", "com", ".", "ibm", ".", "ws", ".", "ffdc", ".", "FFDCFilter", ".", "processException", "(", "ex", ",", "\"com.ibm.ws.cache.CacheEntry.getValue\"", ",", "\"200\"", ",", "this", ")", ";", "}", "if", "(", "value", "!=", "null", ")", "{", "serializedValue", "=", "null", ";", "if", "(", "cacheEntryPool", "!=", "null", ")", "{", "if", "(", "cacheEntryPool", ".", "cache", ".", "isCacheSizeInMBEnabled", "(", ")", ")", "{", "long", "newSize", "=", "getObjectSize", "(", ")", ";", "if", "(", "oldSize", "!=", "-", "1", "&&", "newSize", "!=", "-", "1", ")", "{", "cacheEntryPool", ".", "cache", ".", "increaseCacheSizeInBytes", "(", "newSize", "-", "oldSize", ",", "\"GET_VALUE\"", ")", ";", "}", "else", "{", "cacheEntryPool", ".", "cache", ".", "disableCacheSizeInMB", "(", ")", ";", "}", "}", "}", "}", "}", "}", "return", "value", ";", "}" ]
Get's the entry's value
[ "Get", "s", "the", "entry", "s", "value" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/CacheEntry.java#L683-L715
train
OpenLiberty/open-liberty
dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/CacheEntry.java
CacheEntry.setValue
protected void setValue(Object value) { this.value = value; serializedValue = null; timeStamp = System.currentTimeMillis(); this.valueHashcode = 0; }
java
protected void setValue(Object value) { this.value = value; serializedValue = null; timeStamp = System.currentTimeMillis(); this.valueHashcode = 0; }
[ "protected", "void", "setValue", "(", "Object", "value", ")", "{", "this", ".", "value", "=", "value", ";", "serializedValue", "=", "null", ";", "timeStamp", "=", "System", ".", "currentTimeMillis", "(", ")", ";", "this", ".", "valueHashcode", "=", "0", ";", "}" ]
Set's the entry's value
[ "Set", "s", "the", "entry", "s", "value" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/CacheEntry.java#L727-L732
train
OpenLiberty/open-liberty
dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/CacheEntry.java
CacheEntry.reset
public void reset() { if (refCount.get() > 0 && isRefCountingEnabled()) { Tr.warning(tc, "reset called on " + id + " with a refCount of " + refCount); Thread.dumpStack(); } cacheName = null; drsClock = -1; timeStamp = -1; serializedId = null; id = null; if (useByteBuffer && this.value != null) { if (this.value instanceof DistributedNioMapObject) { ((DistributedNioMapObject) this.value).release(); } } serializedValue = null; value = null; clock = CacheConfig.DEFAULT_PRIORITY; refCount.set(0); priority = CacheConfig.DEFAULT_PRIORITY; timeLimit = -1; inactivity = -1; expirationTime = -1; validatorExpirationTime = -1; removeWhenUnpinned = false; _templates = EMPTY_STRING_ARRAY; _dataIds = EMPTY_OBJECT_ARRAY; _serializedDataIds = null; pendingRemoval = false; sharingPolicy = EntryInfo.NOT_SHARED; persistToDisk = true; isOverflowEntry = false; lruEvicted = false; lruHead = null; useByteBuffer = false; aliasList = EMPTY_OBJECT_ARRAY; serializedAliasList = null; userMetaData = null; serializedUserMetaData = null; loadedFromDisk = false; cacheType = CACHE_TYPE_DEFAULT; skipValueSerialized = false; skipMemoryAndWriteToDisk = false; skipMemoryAndWriteToDiskErrorCode = HTODDynacache.NO_EXCEPTION; valueHashcode = 0; externalCacheGroupId = null; }
java
public void reset() { if (refCount.get() > 0 && isRefCountingEnabled()) { Tr.warning(tc, "reset called on " + id + " with a refCount of " + refCount); Thread.dumpStack(); } cacheName = null; drsClock = -1; timeStamp = -1; serializedId = null; id = null; if (useByteBuffer && this.value != null) { if (this.value instanceof DistributedNioMapObject) { ((DistributedNioMapObject) this.value).release(); } } serializedValue = null; value = null; clock = CacheConfig.DEFAULT_PRIORITY; refCount.set(0); priority = CacheConfig.DEFAULT_PRIORITY; timeLimit = -1; inactivity = -1; expirationTime = -1; validatorExpirationTime = -1; removeWhenUnpinned = false; _templates = EMPTY_STRING_ARRAY; _dataIds = EMPTY_OBJECT_ARRAY; _serializedDataIds = null; pendingRemoval = false; sharingPolicy = EntryInfo.NOT_SHARED; persistToDisk = true; isOverflowEntry = false; lruEvicted = false; lruHead = null; useByteBuffer = false; aliasList = EMPTY_OBJECT_ARRAY; serializedAliasList = null; userMetaData = null; serializedUserMetaData = null; loadedFromDisk = false; cacheType = CACHE_TYPE_DEFAULT; skipValueSerialized = false; skipMemoryAndWriteToDisk = false; skipMemoryAndWriteToDiskErrorCode = HTODDynacache.NO_EXCEPTION; valueHashcode = 0; externalCacheGroupId = null; }
[ "public", "void", "reset", "(", ")", "{", "if", "(", "refCount", ".", "get", "(", ")", ">", "0", "&&", "isRefCountingEnabled", "(", ")", ")", "{", "Tr", ".", "warning", "(", "tc", ",", "\"reset called on \"", "+", "id", "+", "\" with a refCount of \"", "+", "refCount", ")", ";", "Thread", ".", "dumpStack", "(", ")", ";", "}", "cacheName", "=", "null", ";", "drsClock", "=", "-", "1", ";", "timeStamp", "=", "-", "1", ";", "serializedId", "=", "null", ";", "id", "=", "null", ";", "if", "(", "useByteBuffer", "&&", "this", ".", "value", "!=", "null", ")", "{", "if", "(", "this", ".", "value", "instanceof", "DistributedNioMapObject", ")", "{", "(", "(", "DistributedNioMapObject", ")", "this", ".", "value", ")", ".", "release", "(", ")", ";", "}", "}", "serializedValue", "=", "null", ";", "value", "=", "null", ";", "clock", "=", "CacheConfig", ".", "DEFAULT_PRIORITY", ";", "refCount", ".", "set", "(", "0", ")", ";", "priority", "=", "CacheConfig", ".", "DEFAULT_PRIORITY", ";", "timeLimit", "=", "-", "1", ";", "inactivity", "=", "-", "1", ";", "expirationTime", "=", "-", "1", ";", "validatorExpirationTime", "=", "-", "1", ";", "removeWhenUnpinned", "=", "false", ";", "_templates", "=", "EMPTY_STRING_ARRAY", ";", "_dataIds", "=", "EMPTY_OBJECT_ARRAY", ";", "_serializedDataIds", "=", "null", ";", "pendingRemoval", "=", "false", ";", "sharingPolicy", "=", "EntryInfo", ".", "NOT_SHARED", ";", "persistToDisk", "=", "true", ";", "isOverflowEntry", "=", "false", ";", "lruEvicted", "=", "false", ";", "lruHead", "=", "null", ";", "useByteBuffer", "=", "false", ";", "aliasList", "=", "EMPTY_OBJECT_ARRAY", ";", "serializedAliasList", "=", "null", ";", "userMetaData", "=", "null", ";", "serializedUserMetaData", "=", "null", ";", "loadedFromDisk", "=", "false", ";", "cacheType", "=", "CACHE_TYPE_DEFAULT", ";", "skipValueSerialized", "=", "false", ";", "skipMemoryAndWriteToDisk", "=", "false", ";", "skipMemoryAndWriteToDiskErrorCode", "=", "HTODDynacache", ".", "NO_EXCEPTION", ";", "valueHashcode", "=", "0", ";", "externalCacheGroupId", "=", "null", ";", "}" ]
This brings this CacheEntry back to the same state it had when it was first created. It does not change its lruArray index. It is called by the Cache when one of the preallocated CacheEntry instances is about to be reused for another logical entry.
[ "This", "brings", "this", "CacheEntry", "back", "to", "the", "same", "state", "it", "had", "when", "it", "was", "first", "created", ".", "It", "does", "not", "change", "its", "lruArray", "index", ".", "It", "is", "called", "by", "the", "Cache", "when", "one", "of", "the", "preallocated", "CacheEntry", "instances", "is", "about", "to", "be", "reused", "for", "another", "logical", "entry", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/CacheEntry.java#L790-L838
train
OpenLiberty/open-liberty
dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/CacheEntry.java
CacheEntry.copy
public void copy(CacheEntry cacheEntry) { if (cacheEntry == this) return; if (useByteBuffer && this.value != null) { if (this.value instanceof DistributedNioMapObject) { ((DistributedNioMapObject) this.value).release(); } } this.value = cacheEntry.value; this.valueHashcode = cacheEntry.valueHashcode; this.serializedValue = cacheEntry.serializedValue; this.serializedId = cacheEntry.serializedId; timeStamp = cacheEntry.timeStamp; expirationTime = cacheEntry.expirationTime; validatorExpirationTime = cacheEntry.validatorExpirationTime; timeLimit = cacheEntry.timeLimit; inactivity = cacheEntry.inactivity; drsClock = cacheEntry.drsClock; id = cacheEntry.id; priority = cacheEntry.priority; if (priority < 0) priority = 0; if (priority > CacheConfig.MAX_PRIORITY) priority = CacheConfig.MAX_PRIORITY; _templates = cacheEntry._templates; _dataIds = cacheEntry._dataIds; _serializedDataIds = cacheEntry._serializedDataIds; sharingPolicy = cacheEntry.sharingPolicy; persistToDisk = cacheEntry.persistToDisk; refCount = new AtomicInteger(cacheEntry.refCount.get()); aliasList = cacheEntry.aliasList; serializedAliasList = cacheEntry.serializedAliasList; useByteBuffer = cacheEntry.useByteBuffer; userMetaData = cacheEntry.userMetaData; serializedUserMetaData = cacheEntry.serializedUserMetaData; loadedFromDisk = cacheEntry.loadedFromDisk; cacheType = cacheEntry.cacheType; skipValueSerialized = cacheEntry.skipValueSerialized; skipMemoryAndWriteToDisk = cacheEntry.skipMemoryAndWriteToDisk; skipMemoryAndWriteToDiskErrorCode = cacheEntry.skipMemoryAndWriteToDiskErrorCode; vbcSource = cacheEntry.vbcSource; externalCacheGroupId = cacheEntry.externalCacheGroupId; //Note: clock is not set here because it's really owned //by the cache. Only the cache should say when the clock //changes. It makes the cache code more readable. }
java
public void copy(CacheEntry cacheEntry) { if (cacheEntry == this) return; if (useByteBuffer && this.value != null) { if (this.value instanceof DistributedNioMapObject) { ((DistributedNioMapObject) this.value).release(); } } this.value = cacheEntry.value; this.valueHashcode = cacheEntry.valueHashcode; this.serializedValue = cacheEntry.serializedValue; this.serializedId = cacheEntry.serializedId; timeStamp = cacheEntry.timeStamp; expirationTime = cacheEntry.expirationTime; validatorExpirationTime = cacheEntry.validatorExpirationTime; timeLimit = cacheEntry.timeLimit; inactivity = cacheEntry.inactivity; drsClock = cacheEntry.drsClock; id = cacheEntry.id; priority = cacheEntry.priority; if (priority < 0) priority = 0; if (priority > CacheConfig.MAX_PRIORITY) priority = CacheConfig.MAX_PRIORITY; _templates = cacheEntry._templates; _dataIds = cacheEntry._dataIds; _serializedDataIds = cacheEntry._serializedDataIds; sharingPolicy = cacheEntry.sharingPolicy; persistToDisk = cacheEntry.persistToDisk; refCount = new AtomicInteger(cacheEntry.refCount.get()); aliasList = cacheEntry.aliasList; serializedAliasList = cacheEntry.serializedAliasList; useByteBuffer = cacheEntry.useByteBuffer; userMetaData = cacheEntry.userMetaData; serializedUserMetaData = cacheEntry.serializedUserMetaData; loadedFromDisk = cacheEntry.loadedFromDisk; cacheType = cacheEntry.cacheType; skipValueSerialized = cacheEntry.skipValueSerialized; skipMemoryAndWriteToDisk = cacheEntry.skipMemoryAndWriteToDisk; skipMemoryAndWriteToDiskErrorCode = cacheEntry.skipMemoryAndWriteToDiskErrorCode; vbcSource = cacheEntry.vbcSource; externalCacheGroupId = cacheEntry.externalCacheGroupId; //Note: clock is not set here because it's really owned //by the cache. Only the cache should say when the clock //changes. It makes the cache code more readable. }
[ "public", "void", "copy", "(", "CacheEntry", "cacheEntry", ")", "{", "if", "(", "cacheEntry", "==", "this", ")", "return", ";", "if", "(", "useByteBuffer", "&&", "this", ".", "value", "!=", "null", ")", "{", "if", "(", "this", ".", "value", "instanceof", "DistributedNioMapObject", ")", "{", "(", "(", "DistributedNioMapObject", ")", "this", ".", "value", ")", ".", "release", "(", ")", ";", "}", "}", "this", ".", "value", "=", "cacheEntry", ".", "value", ";", "this", ".", "valueHashcode", "=", "cacheEntry", ".", "valueHashcode", ";", "this", ".", "serializedValue", "=", "cacheEntry", ".", "serializedValue", ";", "this", ".", "serializedId", "=", "cacheEntry", ".", "serializedId", ";", "timeStamp", "=", "cacheEntry", ".", "timeStamp", ";", "expirationTime", "=", "cacheEntry", ".", "expirationTime", ";", "validatorExpirationTime", "=", "cacheEntry", ".", "validatorExpirationTime", ";", "timeLimit", "=", "cacheEntry", ".", "timeLimit", ";", "inactivity", "=", "cacheEntry", ".", "inactivity", ";", "drsClock", "=", "cacheEntry", ".", "drsClock", ";", "id", "=", "cacheEntry", ".", "id", ";", "priority", "=", "cacheEntry", ".", "priority", ";", "if", "(", "priority", "<", "0", ")", "priority", "=", "0", ";", "if", "(", "priority", ">", "CacheConfig", ".", "MAX_PRIORITY", ")", "priority", "=", "CacheConfig", ".", "MAX_PRIORITY", ";", "_templates", "=", "cacheEntry", ".", "_templates", ";", "_dataIds", "=", "cacheEntry", ".", "_dataIds", ";", "_serializedDataIds", "=", "cacheEntry", ".", "_serializedDataIds", ";", "sharingPolicy", "=", "cacheEntry", ".", "sharingPolicy", ";", "persistToDisk", "=", "cacheEntry", ".", "persistToDisk", ";", "refCount", "=", "new", "AtomicInteger", "(", "cacheEntry", ".", "refCount", ".", "get", "(", ")", ")", ";", "aliasList", "=", "cacheEntry", ".", "aliasList", ";", "serializedAliasList", "=", "cacheEntry", ".", "serializedAliasList", ";", "useByteBuffer", "=", "cacheEntry", ".", "useByteBuffer", ";", "userMetaData", "=", "cacheEntry", ".", "userMetaData", ";", "serializedUserMetaData", "=", "cacheEntry", ".", "serializedUserMetaData", ";", "loadedFromDisk", "=", "cacheEntry", ".", "loadedFromDisk", ";", "cacheType", "=", "cacheEntry", ".", "cacheType", ";", "skipValueSerialized", "=", "cacheEntry", ".", "skipValueSerialized", ";", "skipMemoryAndWriteToDisk", "=", "cacheEntry", ".", "skipMemoryAndWriteToDisk", ";", "skipMemoryAndWriteToDiskErrorCode", "=", "cacheEntry", ".", "skipMemoryAndWriteToDiskErrorCode", ";", "vbcSource", "=", "cacheEntry", ".", "vbcSource", ";", "externalCacheGroupId", "=", "cacheEntry", ".", "externalCacheGroupId", ";", "//Note: clock is not set here because it's really owned", "//by the cache. Only the cache should say when the clock", "//changes. It makes the cache code more readable.", "}" ]
This method copies the state of another CacheEntry into this CacheEntry. It is called by the Cache when a CacheEntry is imported from another JVM. @param cacheEntry The CacheEntry that this CacheEntry is copied into.
[ "This", "method", "copies", "the", "state", "of", "another", "CacheEntry", "into", "this", "CacheEntry", ".", "It", "is", "called", "by", "the", "Cache", "when", "a", "CacheEntry", "is", "imported", "from", "another", "JVM", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/CacheEntry.java#L847-L895
train
OpenLiberty/open-liberty
dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/CacheEntry.java
CacheEntry.getUserMetaData
@Override public Object getUserMetaData() { if (serializedUserMetaData != null) { try { userMetaData = SerializationUtility.deserialize(serializedUserMetaData, cacheName); } catch (Exception ex) { com.ibm.ws.ffdc.FFDCFilter.processException(ex, "com.ibm.ws.cache.CacheEntry.getUserMetaData", "600", this); } serializedUserMetaData = null; } return userMetaData; }
java
@Override public Object getUserMetaData() { if (serializedUserMetaData != null) { try { userMetaData = SerializationUtility.deserialize(serializedUserMetaData, cacheName); } catch (Exception ex) { com.ibm.ws.ffdc.FFDCFilter.processException(ex, "com.ibm.ws.cache.CacheEntry.getUserMetaData", "600", this); } serializedUserMetaData = null; } return userMetaData; }
[ "@", "Override", "public", "Object", "getUserMetaData", "(", ")", "{", "if", "(", "serializedUserMetaData", "!=", "null", ")", "{", "try", "{", "userMetaData", "=", "SerializationUtility", ".", "deserialize", "(", "serializedUserMetaData", ",", "cacheName", ")", ";", "}", "catch", "(", "Exception", "ex", ")", "{", "com", ".", "ibm", ".", "ws", ".", "ffdc", ".", "FFDCFilter", ".", "processException", "(", "ex", ",", "\"com.ibm.ws.cache.CacheEntry.getUserMetaData\"", ",", "\"600\"", ",", "this", ")", ";", "}", "serializedUserMetaData", "=", "null", ";", "}", "return", "userMetaData", ";", "}" ]
Get's the userMetaData
[ "Get", "s", "the", "userMetaData" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/CacheEntry.java#L1156-L1167
train
OpenLiberty/open-liberty
dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/CacheEntry.java
CacheEntry.getCacheValueSize
@Override public long getCacheValueSize() { long valuesize = -1; if (this.value != null) { Object localValue = this.value; valuesize = ObjectSizer.getSize(localValue); } else { if (this.serializedValue != null) { byte[] localSerializedValue = this.serializedValue; valuesize = ObjectSizer.getSize(localSerializedValue); } } // System.out.println("Returning cacheValueSize = " + valuesize); return valuesize; }
java
@Override public long getCacheValueSize() { long valuesize = -1; if (this.value != null) { Object localValue = this.value; valuesize = ObjectSizer.getSize(localValue); } else { if (this.serializedValue != null) { byte[] localSerializedValue = this.serializedValue; valuesize = ObjectSizer.getSize(localSerializedValue); } } // System.out.println("Returning cacheValueSize = " + valuesize); return valuesize; }
[ "@", "Override", "public", "long", "getCacheValueSize", "(", ")", "{", "long", "valuesize", "=", "-", "1", ";", "if", "(", "this", ".", "value", "!=", "null", ")", "{", "Object", "localValue", "=", "this", ".", "value", ";", "valuesize", "=", "ObjectSizer", ".", "getSize", "(", "localValue", ")", ";", "}", "else", "{", "if", "(", "this", ".", "serializedValue", "!=", "null", ")", "{", "byte", "[", "]", "localSerializedValue", "=", "this", ".", "serializedValue", ";", "valuesize", "=", "ObjectSizer", ".", "getSize", "(", "localSerializedValue", ")", ";", "}", "}", "// System.out.println(\"Returning cacheValueSize = \" + valuesize);", "return", "valuesize", ";", "}" ]
Computes the best-effort size of the cache entry's value. Returns -1 if value could not be computed.
[ "Computes", "the", "best", "-", "effort", "size", "of", "the", "cache", "entry", "s", "value", ".", "Returns", "-", "1", "if", "value", "could", "not", "be", "computed", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/CacheEntry.java#L1484-L1499
train
OpenLiberty/open-liberty
dev/com.ibm.ws.webcontainer.servlet.3.1/src/com/ibm/ws/webcontainer31/srt/SRTRequestContext31.java
SRTRequestContext31.generateNewId
public HttpSession generateNewId(WebApp webapp) { HttpSession existingSession = (HttpSession) webappToSessionMap.get(webapp); if (existingSession != null) { if (!webapp.getSessionContext().isValid(existingSession, request, false)) { existingSession = null; } } else { // Looks like the session wasn't obtained during the preinvoke // call. Should only happen if session doesn't exist at preinvoke. existingSession = webapp.getSessionContext().getIHttpSession(request, (HttpServletResponse) request.getResponse(), false); } if ( existingSession == null) { if (TraceComponent.isAnyTracingEnabled() && tc.isErrorEnabled()) { Tr.error(tc, "changeSessionId.no.session.associated.with.request", new Object[] {request.getRequestURI()}); } throw new IllegalStateException(Tr.formatMessage(tc, "changeSessionId.no.session.associated.with.request", request.getRequestURI())); } HttpSession session = ((HttpSessionContext31Impl)webapp.getSessionContext()).generateNewId(request, (HttpServletResponse) request.getResponse(), existingSession); return session; }
java
public HttpSession generateNewId(WebApp webapp) { HttpSession existingSession = (HttpSession) webappToSessionMap.get(webapp); if (existingSession != null) { if (!webapp.getSessionContext().isValid(existingSession, request, false)) { existingSession = null; } } else { // Looks like the session wasn't obtained during the preinvoke // call. Should only happen if session doesn't exist at preinvoke. existingSession = webapp.getSessionContext().getIHttpSession(request, (HttpServletResponse) request.getResponse(), false); } if ( existingSession == null) { if (TraceComponent.isAnyTracingEnabled() && tc.isErrorEnabled()) { Tr.error(tc, "changeSessionId.no.session.associated.with.request", new Object[] {request.getRequestURI()}); } throw new IllegalStateException(Tr.formatMessage(tc, "changeSessionId.no.session.associated.with.request", request.getRequestURI())); } HttpSession session = ((HttpSessionContext31Impl)webapp.getSessionContext()).generateNewId(request, (HttpServletResponse) request.getResponse(), existingSession); return session; }
[ "public", "HttpSession", "generateNewId", "(", "WebApp", "webapp", ")", "{", "HttpSession", "existingSession", "=", "(", "HttpSession", ")", "webappToSessionMap", ".", "get", "(", "webapp", ")", ";", "if", "(", "existingSession", "!=", "null", ")", "{", "if", "(", "!", "webapp", ".", "getSessionContext", "(", ")", ".", "isValid", "(", "existingSession", ",", "request", ",", "false", ")", ")", "{", "existingSession", "=", "null", ";", "}", "}", "else", "{", "// Looks like the session wasn't obtained during the preinvoke", "// call. Should only happen if session doesn't exist at preinvoke.", "existingSession", "=", "webapp", ".", "getSessionContext", "(", ")", ".", "getIHttpSession", "(", "request", ",", "(", "HttpServletResponse", ")", "request", ".", "getResponse", "(", ")", ",", "false", ")", ";", "}", "if", "(", "existingSession", "==", "null", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isErrorEnabled", "(", ")", ")", "{", "Tr", ".", "error", "(", "tc", ",", "\"changeSessionId.no.session.associated.with.request\"", ",", "new", "Object", "[", "]", "{", "request", ".", "getRequestURI", "(", ")", "}", ")", ";", "}", "throw", "new", "IllegalStateException", "(", "Tr", ".", "formatMessage", "(", "tc", ",", "\"changeSessionId.no.session.associated.with.request\"", ",", "request", ".", "getRequestURI", "(", ")", ")", ")", ";", "}", "HttpSession", "session", "=", "(", "(", "HttpSessionContext31Impl", ")", "webapp", ".", "getSessionContext", "(", ")", ")", ".", "generateNewId", "(", "request", ",", "(", "HttpServletResponse", ")", "request", ".", "getResponse", "(", ")", ",", "existingSession", ")", ";", "return", "session", ";", "}" ]
Added for support of HttpSessionIdListeners
[ "Added", "for", "support", "of", "HttpSessionIdListeners" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.webcontainer.servlet.3.1/src/com/ibm/ws/webcontainer31/srt/SRTRequestContext31.java#L45-L66
train
OpenLiberty/open-liberty
dev/com.ibm.rls.jdbc/src/com/ibm/ws/recoverylog/custom/jdbc/impl/SQLRecoverableUnitImpl.java
SQLRecoverableUnitImpl.lookupSection
public RecoverableUnitSection lookupSection(int identity) { if (tc.isEntryEnabled()) Tr.entry(tc, "lookupSection",new java.lang.Object[]{this,new Integer(identity)}); SQLRecoverableUnitSectionImpl recoverableUnitSection = (SQLRecoverableUnitSectionImpl)_recoverableUnitSections.get(new Integer(identity)); if (tc.isEntryEnabled()) Tr.exit(tc, "lookupSection",recoverableUnitSection); return recoverableUnitSection; }
java
public RecoverableUnitSection lookupSection(int identity) { if (tc.isEntryEnabled()) Tr.entry(tc, "lookupSection",new java.lang.Object[]{this,new Integer(identity)}); SQLRecoverableUnitSectionImpl recoverableUnitSection = (SQLRecoverableUnitSectionImpl)_recoverableUnitSections.get(new Integer(identity)); if (tc.isEntryEnabled()) Tr.exit(tc, "lookupSection",recoverableUnitSection); return recoverableUnitSection; }
[ "public", "RecoverableUnitSection", "lookupSection", "(", "int", "identity", ")", "{", "if", "(", "tc", ".", "isEntryEnabled", "(", ")", ")", "Tr", ".", "entry", "(", "tc", ",", "\"lookupSection\"", ",", "new", "java", ".", "lang", ".", "Object", "[", "]", "{", "this", ",", "new", "Integer", "(", "identity", ")", "}", ")", ";", "SQLRecoverableUnitSectionImpl", "recoverableUnitSection", "=", "(", "SQLRecoverableUnitSectionImpl", ")", "_recoverableUnitSections", ".", "get", "(", "new", "Integer", "(", "identity", ")", ")", ";", "if", "(", "tc", ".", "isEntryEnabled", "(", ")", ")", "Tr", ".", "exit", "(", "tc", ",", "\"lookupSection\"", ",", "recoverableUnitSection", ")", ";", "return", "recoverableUnitSection", ";", "}" ]
Returns the recoverable unit section previously created with the supplied identity. If no such recoverable unit section exists, this method returns null. @param identity The identitiy of the required recoverable unit section. @return The recoverable unit section previously created with the supplied identity.
[ "Returns", "the", "recoverable", "unit", "section", "previously", "created", "with", "the", "supplied", "identity", ".", "If", "no", "such", "recoverable", "unit", "section", "exists", "this", "method", "returns", "null", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.rls.jdbc/src/com/ibm/ws/recoverylog/custom/jdbc/impl/SQLRecoverableUnitImpl.java#L306-L314
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/jfapchannel/impl/rldispatcher/ConversationReceiveListenerErrorOccurredInvocation.java
ConversationReceiveListenerErrorOccurredInvocation.invoke
protected synchronized void invoke() { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "invoke"); try { listener.errorOccurred(exception, segmentType, requestNumber, priority, conversation); } catch(Throwable t) { FFDCFilter.processException (t, "com.ibm.ws.sib.jfapchannel.impl.rldispatcher.ConversationReceiveListenerErrorOccurredInvocation", JFapChannelConstants.CRLERROROCCURREDINVOKE_INVOKE_01); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "exception thrown by conversation receive listener"); if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) SibTr.exception(this, tc, t); connection.invalidate(true, t, "exception thrown in errorOccurred method - "+t.getMessage()); // D224570 } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "invoke"); }
java
protected synchronized void invoke() { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "invoke"); try { listener.errorOccurred(exception, segmentType, requestNumber, priority, conversation); } catch(Throwable t) { FFDCFilter.processException (t, "com.ibm.ws.sib.jfapchannel.impl.rldispatcher.ConversationReceiveListenerErrorOccurredInvocation", JFapChannelConstants.CRLERROROCCURREDINVOKE_INVOKE_01); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "exception thrown by conversation receive listener"); if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) SibTr.exception(this, tc, t); connection.invalidate(true, t, "exception thrown in errorOccurred method - "+t.getMessage()); // D224570 } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "invoke"); }
[ "protected", "synchronized", "void", "invoke", "(", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "entry", "(", "this", ",", "tc", ",", "\"invoke\"", ")", ";", "try", "{", "listener", ".", "errorOccurred", "(", "exception", ",", "segmentType", ",", "requestNumber", ",", "priority", ",", "conversation", ")", ";", "}", "catch", "(", "Throwable", "t", ")", "{", "FFDCFilter", ".", "processException", "(", "t", ",", "\"com.ibm.ws.sib.jfapchannel.impl.rldispatcher.ConversationReceiveListenerErrorOccurredInvocation\"", ",", "JFapChannelConstants", ".", "CRLERROROCCURREDINVOKE_INVOKE_01", ")", ";", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "SibTr", ".", "debug", "(", "this", ",", "tc", ",", "\"exception thrown by conversation receive listener\"", ")", ";", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEventEnabled", "(", ")", ")", "SibTr", ".", "exception", "(", "this", ",", "tc", ",", "t", ")", ";", "connection", ".", "invalidate", "(", "true", ",", "t", ",", "\"exception thrown in errorOccurred method - \"", "+", "t", ".", "getMessage", "(", ")", ")", ";", "// D224570", "}", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "exit", "(", "this", ",", "tc", ",", "\"invoke\"", ")", ";", "}" ]
Invokes the error occurred callback of a receive listener. The information required for this invocation is encapsulated in this class. If code in the callback throws an exception then the connection is invalidated.
[ "Invokes", "the", "error", "occurred", "callback", "of", "a", "receive", "listener", ".", "The", "information", "required", "for", "this", "invocation", "is", "encapsulated", "in", "this", "class", ".", "If", "code", "in", "the", "callback", "throws", "an", "exception", "then", "the", "connection", "is", "invalidated", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/jfapchannel/impl/rldispatcher/ConversationReceiveListenerErrorOccurredInvocation.java#L95-L117
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/jfapchannel/impl/rldispatcher/ConversationReceiveListenerErrorOccurredInvocation.java
ConversationReceiveListenerErrorOccurredInvocation.reset
protected synchronized void reset(Connection connection, ConversationReceiveListener listener, SIConnectionLostException exception, int segmentType, int requestNumber, int priority, Conversation conversation) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "reset", new Object[] { connection, listener, exception, ""+segmentType, ""+requestNumber, ""+priority, conversation }); this.connection = connection; this.listener = listener; this.exception = exception; this.segmentType = segmentType; this.requestNumber = requestNumber; this.priority = priority; this.conversation = conversation; setDispatchable(null); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "reset"); }
java
protected synchronized void reset(Connection connection, ConversationReceiveListener listener, SIConnectionLostException exception, int segmentType, int requestNumber, int priority, Conversation conversation) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "reset", new Object[] { connection, listener, exception, ""+segmentType, ""+requestNumber, ""+priority, conversation }); this.connection = connection; this.listener = listener; this.exception = exception; this.segmentType = segmentType; this.requestNumber = requestNumber; this.priority = priority; this.conversation = conversation; setDispatchable(null); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "reset"); }
[ "protected", "synchronized", "void", "reset", "(", "Connection", "connection", ",", "ConversationReceiveListener", "listener", ",", "SIConnectionLostException", "exception", ",", "int", "segmentType", ",", "int", "requestNumber", ",", "int", "priority", ",", "Conversation", "conversation", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "entry", "(", "this", ",", "tc", ",", "\"reset\"", ",", "new", "Object", "[", "]", "{", "connection", ",", "listener", ",", "exception", ",", "\"\"", "+", "segmentType", ",", "\"\"", "+", "requestNumber", ",", "\"\"", "+", "priority", ",", "conversation", "}", ")", ";", "this", ".", "connection", "=", "connection", ";", "this", ".", "listener", "=", "listener", ";", "this", ".", "exception", "=", "exception", ";", "this", ".", "segmentType", "=", "segmentType", ";", "this", ".", "requestNumber", "=", "requestNumber", ";", "this", ".", "priority", "=", "priority", ";", "this", ".", "conversation", "=", "conversation", ";", "setDispatchable", "(", "null", ")", ";", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "exit", "(", "this", ",", "tc", ",", "\"reset\"", ")", ";", "}" ]
Resets the state of this object. Used for pooling.
[ "Resets", "the", "state", "of", "this", "object", ".", "Used", "for", "pooling", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/jfapchannel/impl/rldispatcher/ConversationReceiveListenerErrorOccurredInvocation.java#L120-L150
train
OpenLiberty/open-liberty
dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/component/visit/PartialVisitContext.java
PartialVisitContext._idAdded
private void _idAdded(String clientId) { // An id to visit has been added, update our other // collections to reflect this. // Update the ids collection _ids.add(_getIdFromClientId(clientId)); // Update the unvisited ids collection _unvisitedClientIds.add(clientId); // Update the subtree ids collection _addSubtreeClientId(clientId); }
java
private void _idAdded(String clientId) { // An id to visit has been added, update our other // collections to reflect this. // Update the ids collection _ids.add(_getIdFromClientId(clientId)); // Update the unvisited ids collection _unvisitedClientIds.add(clientId); // Update the subtree ids collection _addSubtreeClientId(clientId); }
[ "private", "void", "_idAdded", "(", "String", "clientId", ")", "{", "// An id to visit has been added, update our other", "// collections to reflect this.", "// Update the ids collection", "_ids", ".", "add", "(", "_getIdFromClientId", "(", "clientId", ")", ")", ";", "// Update the unvisited ids collection", "_unvisitedClientIds", ".", "add", "(", "clientId", ")", ";", "// Update the subtree ids collection", "_addSubtreeClientId", "(", "clientId", ")", ";", "}" ]
an new id has been added.
[ "an", "new", "id", "has", "been", "added", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/component/visit/PartialVisitContext.java#L234-L247
train
OpenLiberty/open-liberty
dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/component/visit/PartialVisitContext.java
PartialVisitContext._getVisitId
private String _getVisitId(UIComponent component) { // We first check to see whether the component's id // is in our id collection. We do this before checking // for the full client id because getting the full client id // is more expensive than just getting the local id. String id = component.getId(); if ((id != null) && !_ids.contains(id)) { return null; } // The id was a match - now check the client id. // note that client id should never be null (should be // generated even if id is null, so asserting this.) String clientId = component.getClientId(getFacesContext()); assert(clientId != null); return _clientIds.contains(clientId) ? clientId : null; }
java
private String _getVisitId(UIComponent component) { // We first check to see whether the component's id // is in our id collection. We do this before checking // for the full client id because getting the full client id // is more expensive than just getting the local id. String id = component.getId(); if ((id != null) && !_ids.contains(id)) { return null; } // The id was a match - now check the client id. // note that client id should never be null (should be // generated even if id is null, so asserting this.) String clientId = component.getClientId(getFacesContext()); assert(clientId != null); return _clientIds.contains(clientId) ? clientId : null; }
[ "private", "String", "_getVisitId", "(", "UIComponent", "component", ")", "{", "// We first check to see whether the component's id", "// is in our id collection. We do this before checking", "// for the full client id because getting the full client id", "// is more expensive than just getting the local id.", "String", "id", "=", "component", ".", "getId", "(", ")", ";", "if", "(", "(", "id", "!=", "null", ")", "&&", "!", "_ids", ".", "contains", "(", "id", ")", ")", "{", "return", "null", ";", "}", "// The id was a match - now check the client id.", "// note that client id should never be null (should be", "// generated even if id is null, so asserting this.)", "String", "clientId", "=", "component", ".", "getClientId", "(", "getFacesContext", "(", ")", ")", ";", "assert", "(", "clientId", "!=", "null", ")", ";", "return", "_clientIds", ".", "contains", "(", "clientId", ")", "?", "clientId", ":", "null", ";", "}" ]
If so, returns its client id. If not, returns null.
[ "If", "so", "returns", "its", "client", "id", ".", "If", "not", "returns", "null", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/component/visit/PartialVisitContext.java#L267-L287
train
OpenLiberty/open-liberty
dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/component/visit/PartialVisitContext.java
PartialVisitContext._getIdFromClientId
private String _getIdFromClientId(String clientId) { final char separator = getFacesContext().getNamingContainerSeparatorChar(); int lastIndex = clientId.lastIndexOf(separator); String id = null; if (lastIndex < 0) { id = clientId; } else if (lastIndex < (clientId.length() - 1)) { id = clientId.substring(lastIndex + 1); } //else //{ // TODO log warning for trailing colon case //} return id; }
java
private String _getIdFromClientId(String clientId) { final char separator = getFacesContext().getNamingContainerSeparatorChar(); int lastIndex = clientId.lastIndexOf(separator); String id = null; if (lastIndex < 0) { id = clientId; } else if (lastIndex < (clientId.length() - 1)) { id = clientId.substring(lastIndex + 1); } //else //{ // TODO log warning for trailing colon case //} return id; }
[ "private", "String", "_getIdFromClientId", "(", "String", "clientId", ")", "{", "final", "char", "separator", "=", "getFacesContext", "(", ")", ".", "getNamingContainerSeparatorChar", "(", ")", ";", "int", "lastIndex", "=", "clientId", ".", "lastIndexOf", "(", "separator", ")", ";", "String", "id", "=", "null", ";", "if", "(", "lastIndex", "<", "0", ")", "{", "id", "=", "clientId", ";", "}", "else", "if", "(", "lastIndex", "<", "(", "clientId", ".", "length", "(", ")", "-", "1", ")", ")", "{", "id", "=", "clientId", ".", "substring", "(", "lastIndex", "+", "1", ")", ";", "}", "//else", "//{", "// TODO log warning for trailing colon case", "//}", "return", "id", ";", "}" ]
out the trailing id segmetn.
[ "out", "the", "trailing", "id", "segmetn", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/component/visit/PartialVisitContext.java#L293-L314
train
OpenLiberty/open-liberty
dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/component/visit/PartialVisitContext.java
PartialVisitContext._addSubtreeClientId
private void _addSubtreeClientId(String clientId) { // Loop over the client id and find the substring corresponding to // each ancestor NamingContainer client id. For each ancestor // NamingContainer, add an entry into the map for the full client // id. final char separator = getFacesContext().getNamingContainerSeparatorChar(); int length = clientId.length(); for (int i = 0; i < length; i++) { if (clientId.charAt(i) == separator) { // We found an ancestor NamingContainer client id - add // an entry to the map. String namingContainerClientId = clientId.substring(0, i); // Check to see whether we've already ids under this // NamingContainer client id. If not, create the // Collection for this NamingContainer client id and // stash it away in our map Collection<String> c = _subtreeClientIds.get(namingContainerClientId); if (c == null) { // TODO: smarter initial size? c = new ArrayList<String>(); _subtreeClientIds.put(namingContainerClientId, c); } // Stash away the client id c.add(clientId); } } }
java
private void _addSubtreeClientId(String clientId) { // Loop over the client id and find the substring corresponding to // each ancestor NamingContainer client id. For each ancestor // NamingContainer, add an entry into the map for the full client // id. final char separator = getFacesContext().getNamingContainerSeparatorChar(); int length = clientId.length(); for (int i = 0; i < length; i++) { if (clientId.charAt(i) == separator) { // We found an ancestor NamingContainer client id - add // an entry to the map. String namingContainerClientId = clientId.substring(0, i); // Check to see whether we've already ids under this // NamingContainer client id. If not, create the // Collection for this NamingContainer client id and // stash it away in our map Collection<String> c = _subtreeClientIds.get(namingContainerClientId); if (c == null) { // TODO: smarter initial size? c = new ArrayList<String>(); _subtreeClientIds.put(namingContainerClientId, c); } // Stash away the client id c.add(clientId); } } }
[ "private", "void", "_addSubtreeClientId", "(", "String", "clientId", ")", "{", "// Loop over the client id and find the substring corresponding to", "// each ancestor NamingContainer client id. For each ancestor", "// NamingContainer, add an entry into the map for the full client", "// id.", "final", "char", "separator", "=", "getFacesContext", "(", ")", ".", "getNamingContainerSeparatorChar", "(", ")", ";", "int", "length", "=", "clientId", ".", "length", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "length", ";", "i", "++", ")", "{", "if", "(", "clientId", ".", "charAt", "(", "i", ")", "==", "separator", ")", "{", "// We found an ancestor NamingContainer client id - add ", "// an entry to the map.", "String", "namingContainerClientId", "=", "clientId", ".", "substring", "(", "0", ",", "i", ")", ";", "// Check to see whether we've already ids under this", "// NamingContainer client id. If not, create the ", "// Collection for this NamingContainer client id and", "// stash it away in our map", "Collection", "<", "String", ">", "c", "=", "_subtreeClientIds", ".", "get", "(", "namingContainerClientId", ")", ";", "if", "(", "c", "==", "null", ")", "{", "// TODO: smarter initial size?", "c", "=", "new", "ArrayList", "<", "String", ">", "(", ")", ";", "_subtreeClientIds", ".", "put", "(", "namingContainerClientId", ",", "c", ")", ";", "}", "// Stash away the client id", "c", ".", "add", "(", "clientId", ")", ";", "}", "}", "}" ]
subtree client ids
[ "subtree", "client", "ids" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/component/visit/PartialVisitContext.java#L319-L354
train
OpenLiberty/open-liberty
dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/component/visit/PartialVisitContext.java
PartialVisitContext._removeSubtreeClientId
private void _removeSubtreeClientId(String clientId) { // Loop through each entry in the map and check to see whether // the client id to remove should be contained in the corresponding // collection - ie. whether the key (the NamingContainer client id) // is present at the start of the client id to remove. for (String key : _subtreeClientIds.keySet()) { if (clientId.startsWith(key)) { // If the clientId starts with the key, we should // have an entry for this clientId in the corresponding // collection. Remove it. Collection<String> ids = _subtreeClientIds.get(key); ids.remove(clientId); } } }
java
private void _removeSubtreeClientId(String clientId) { // Loop through each entry in the map and check to see whether // the client id to remove should be contained in the corresponding // collection - ie. whether the key (the NamingContainer client id) // is present at the start of the client id to remove. for (String key : _subtreeClientIds.keySet()) { if (clientId.startsWith(key)) { // If the clientId starts with the key, we should // have an entry for this clientId in the corresponding // collection. Remove it. Collection<String> ids = _subtreeClientIds.get(key); ids.remove(clientId); } } }
[ "private", "void", "_removeSubtreeClientId", "(", "String", "clientId", ")", "{", "// Loop through each entry in the map and check to see whether", "// the client id to remove should be contained in the corresponding", "// collection - ie. whether the key (the NamingContainer client id)", "// is present at the start of the client id to remove.", "for", "(", "String", "key", ":", "_subtreeClientIds", ".", "keySet", "(", ")", ")", "{", "if", "(", "clientId", ".", "startsWith", "(", "key", ")", ")", "{", "// If the clientId starts with the key, we should", "// have an entry for this clientId in the corresponding", "// collection. Remove it.", "Collection", "<", "String", ">", "ids", "=", "_subtreeClientIds", ".", "get", "(", "key", ")", ";", "ids", ".", "remove", "(", "clientId", ")", ";", "}", "}", "}" ]
entries from our subtree collections
[ "entries", "from", "our", "subtree", "collections" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/component/visit/PartialVisitContext.java#L358-L375
train
OpenLiberty/open-liberty
dev/com.ibm.ws.transport.iiop/src/com/ibm/ws/transport/iiop/yoko/ORBConfigAdapter.java
ORBConfigAdapter.createServerORB
@Override public ORB createServerORB(Map<String, Object> config, Map<String, Object> extraConfig, List<IIOPEndpoint> endpoints, Collection<SubsystemFactory> subsystemFactories) throws ConfigException { ORB orb = createORB(translateToTargetArgs(config, subsystemFactories), translateToTargetProps(config, extraConfig, endpoints, subsystemFactories)); return orb; }
java
@Override public ORB createServerORB(Map<String, Object> config, Map<String, Object> extraConfig, List<IIOPEndpoint> endpoints, Collection<SubsystemFactory> subsystemFactories) throws ConfigException { ORB orb = createORB(translateToTargetArgs(config, subsystemFactories), translateToTargetProps(config, extraConfig, endpoints, subsystemFactories)); return orb; }
[ "@", "Override", "public", "ORB", "createServerORB", "(", "Map", "<", "String", ",", "Object", ">", "config", ",", "Map", "<", "String", ",", "Object", ">", "extraConfig", ",", "List", "<", "IIOPEndpoint", ">", "endpoints", ",", "Collection", "<", "SubsystemFactory", ">", "subsystemFactories", ")", "throws", "ConfigException", "{", "ORB", "orb", "=", "createORB", "(", "translateToTargetArgs", "(", "config", ",", "subsystemFactories", ")", ",", "translateToTargetProps", "(", "config", ",", "extraConfig", ",", "endpoints", ",", "subsystemFactories", ")", ")", ";", "return", "orb", ";", "}" ]
Create an ORB for a CORBABean server context. @param server The CORBABean that owns this ORB's configuration. @return An ORB instance configured for the CORBABean. @exception ConfigException
[ "Create", "an", "ORB", "for", "a", "CORBABean", "server", "context", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.transport.iiop/src/com/ibm/ws/transport/iiop/yoko/ORBConfigAdapter.java#L51-L55
train
OpenLiberty/open-liberty
dev/com.ibm.ws.transport.iiop/src/com/ibm/ws/transport/iiop/yoko/ORBConfigAdapter.java
ORBConfigAdapter.createClientORB
@Override public ORB createClientORB(Map<String, Object> clientProps, Collection<SubsystemFactory> subsystemFactories) throws ConfigException { return createORB(translateToClientArgs(clientProps, subsystemFactories), translateToClientProps(clientProps, subsystemFactories)); }
java
@Override public ORB createClientORB(Map<String, Object> clientProps, Collection<SubsystemFactory> subsystemFactories) throws ConfigException { return createORB(translateToClientArgs(clientProps, subsystemFactories), translateToClientProps(clientProps, subsystemFactories)); }
[ "@", "Override", "public", "ORB", "createClientORB", "(", "Map", "<", "String", ",", "Object", ">", "clientProps", ",", "Collection", "<", "SubsystemFactory", ">", "subsystemFactories", ")", "throws", "ConfigException", "{", "return", "createORB", "(", "translateToClientArgs", "(", "clientProps", ",", "subsystemFactories", ")", ",", "translateToClientProps", "(", "clientProps", ",", "subsystemFactories", ")", ")", ";", "}" ]
Create an ORB for a CSSBean client context. @return An ORB instance configured for this client access. @exception ConfigException
[ "Create", "an", "ORB", "for", "a", "CSSBean", "client", "context", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.transport.iiop/src/com/ibm/ws/transport/iiop/yoko/ORBConfigAdapter.java#L63-L66
train
OpenLiberty/open-liberty
dev/com.ibm.ws.transport.iiop/src/com/ibm/ws/transport/iiop/yoko/ORBConfigAdapter.java
ORBConfigAdapter.createORB
private ORB createORB(String[] args, Properties props) { return ORB.init(args, props); }
java
private ORB createORB(String[] args, Properties props) { return ORB.init(args, props); }
[ "private", "ORB", "createORB", "(", "String", "[", "]", "args", ",", "Properties", "props", ")", "{", "return", "ORB", ".", "init", "(", "args", ",", "props", ")", ";", "}" ]
Create an ORB instance using the configured argument and property bundles. @param args The String arguments passed to ORB.init(). @param props The property bundle passed to ORB.init(). @return An ORB constructed from the provided args and properties.
[ "Create", "an", "ORB", "instance", "using", "the", "configured", "argument", "and", "property", "bundles", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.transport.iiop/src/com/ibm/ws/transport/iiop/yoko/ORBConfigAdapter.java#L77-L79
train
OpenLiberty/open-liberty
dev/com.ibm.ws.transport.iiop/src/com/ibm/ws/transport/iiop/yoko/ORBConfigAdapter.java
ORBConfigAdapter.translateToTargetArgs
private String[] translateToTargetArgs(Map<String, Object> props, Collection<SubsystemFactory> subsystemFactories) throws ConfigException { ArrayList<String> list = new ArrayList<String>(); for (SubsystemFactory sf : subsystemFactories) { sf.addTargetORBInitArgs(props, list); } if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Configargs: " + list); } return list.toArray(new String[list.size()]); }
java
private String[] translateToTargetArgs(Map<String, Object> props, Collection<SubsystemFactory> subsystemFactories) throws ConfigException { ArrayList<String> list = new ArrayList<String>(); for (SubsystemFactory sf : subsystemFactories) { sf.addTargetORBInitArgs(props, list); } if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Configargs: " + list); } return list.toArray(new String[list.size()]); }
[ "private", "String", "[", "]", "translateToTargetArgs", "(", "Map", "<", "String", ",", "Object", ">", "props", ",", "Collection", "<", "SubsystemFactory", ">", "subsystemFactories", ")", "throws", "ConfigException", "{", "ArrayList", "<", "String", ">", "list", "=", "new", "ArrayList", "<", "String", ">", "(", ")", ";", "for", "(", "SubsystemFactory", "sf", ":", "subsystemFactories", ")", "{", "sf", ".", "addTargetORBInitArgs", "(", "props", ",", "list", ")", ";", "}", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "{", "Tr", ".", "debug", "(", "tc", ",", "\"Configargs: \"", "+", "list", ")", ";", "}", "return", "list", ".", "toArray", "(", "new", "String", "[", "list", ".", "size", "(", ")", "]", ")", ";", "}" ]
Translate a CORBABean configuration into an array of arguments used to configure the ORB instance. @param server The IiopEndpoint we're creating an ORB instance for. @param subsystemFactories subsystem factories to translate configuration @return A String{} array containing the initialization arguments. @exception ConfigException if configuration cannot be interpreted
[ "Translate", "a", "CORBABean", "configuration", "into", "an", "array", "of", "arguments", "used", "to", "configure", "the", "ORB", "instance", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.transport.iiop/src/com/ibm/ws/transport/iiop/yoko/ORBConfigAdapter.java#L93-L105
train
OpenLiberty/open-liberty
dev/com.ibm.ws.transport.iiop/src/com/ibm/ws/transport/iiop/yoko/ORBConfigAdapter.java
ORBConfigAdapter.translateToClientArgs
private String[] translateToClientArgs(Map<String, Object> clientProps, Collection<SubsystemFactory> subsystemFactories) throws ConfigException { ArrayList<String> list = new ArrayList<String>(); for (SubsystemFactory sf : subsystemFactories) { sf.addClientORBInitArgs(clientProps, list); } if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Configargs: " + list); } return list.toArray(new String[list.size()]); }
java
private String[] translateToClientArgs(Map<String, Object> clientProps, Collection<SubsystemFactory> subsystemFactories) throws ConfigException { ArrayList<String> list = new ArrayList<String>(); for (SubsystemFactory sf : subsystemFactories) { sf.addClientORBInitArgs(clientProps, list); } if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Configargs: " + list); } return list.toArray(new String[list.size()]); }
[ "private", "String", "[", "]", "translateToClientArgs", "(", "Map", "<", "String", ",", "Object", ">", "clientProps", ",", "Collection", "<", "SubsystemFactory", ">", "subsystemFactories", ")", "throws", "ConfigException", "{", "ArrayList", "<", "String", ">", "list", "=", "new", "ArrayList", "<", "String", ">", "(", ")", ";", "for", "(", "SubsystemFactory", "sf", ":", "subsystemFactories", ")", "{", "sf", ".", "addClientORBInitArgs", "(", "clientProps", ",", "list", ")", ";", "}", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "{", "Tr", ".", "debug", "(", "tc", ",", "\"Configargs: \"", "+", "list", ")", ";", "}", "return", "list", ".", "toArray", "(", "new", "String", "[", "list", ".", "size", "(", ")", "]", ")", ";", "}" ]
Translate client configuration into the argument bundle needed to instantiate the client ORB instance. @param clientProps configuration properties @param subsystemFactories configured subsystem factories @return A String array to be passed to ORB.init(). @exception ConfigException if configuration cannot be interpreted
[ "Translate", "client", "configuration", "into", "the", "argument", "bundle", "needed", "to", "instantiate", "the", "client", "ORB", "instance", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.transport.iiop/src/com/ibm/ws/transport/iiop/yoko/ORBConfigAdapter.java#L154-L166
train
OpenLiberty/open-liberty
dev/com.ibm.ws.transport.iiop/src/com/ibm/ws/transport/iiop/yoko/ORBConfigAdapter.java
ORBConfigAdapter.translateToClientProps
private Properties translateToClientProps(Map<String, Object> clientProps, Collection<SubsystemFactory> subsystemFactories) throws ConfigException { Properties result = createYokoORBProperties(); for (SubsystemFactory sf : subsystemFactories) { addInitializerPropertyForSubsystem(result, sf, false); sf.addClientORBInitProperties(result, clientProps); } return result; }
java
private Properties translateToClientProps(Map<String, Object> clientProps, Collection<SubsystemFactory> subsystemFactories) throws ConfigException { Properties result = createYokoORBProperties(); for (SubsystemFactory sf : subsystemFactories) { addInitializerPropertyForSubsystem(result, sf, false); sf.addClientORBInitProperties(result, clientProps); } return result; }
[ "private", "Properties", "translateToClientProps", "(", "Map", "<", "String", ",", "Object", ">", "clientProps", ",", "Collection", "<", "SubsystemFactory", ">", "subsystemFactories", ")", "throws", "ConfigException", "{", "Properties", "result", "=", "createYokoORBProperties", "(", ")", ";", "for", "(", "SubsystemFactory", "sf", ":", "subsystemFactories", ")", "{", "addInitializerPropertyForSubsystem", "(", "result", ",", "sf", ",", "false", ")", ";", "sf", ".", "addClientORBInitProperties", "(", "result", ",", "clientProps", ")", ";", "}", "return", "result", ";", "}" ]
Translate client configuration into the property bundle necessary to configure the client ORB instance. @param clientProps configuration properties @param subsystemFactories configured subsystem factories @return A property bundle that can be passed to ORB.init(); @exception ConfigException if configuration cannot be interpreted
[ "Translate", "client", "configuration", "into", "the", "property", "bundle", "necessary", "to", "configure", "the", "client", "ORB", "instance", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.transport.iiop/src/com/ibm/ws/transport/iiop/yoko/ORBConfigAdapter.java#L179-L186
train
OpenLiberty/open-liberty
dev/com.ibm.websphere.security/src/com/ibm/ws/security/core/SecurityContext.java
SecurityContext.getName
public static String getName() { String secname = null; WSCredential credential = getCallerWSCredential(); try { if (credential != null && !credential.isUnauthenticated()) { String realmSecname = credential.getRealmSecurityName(); if (realmSecname != null && !realmSecname.isEmpty()) { secname = realmSecname.substring(realmSecname.lastIndexOf(REALM_SEPARATOR) + 1); } } } catch (Exception e) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) Tr.debug(tc, "Internal error: " + e); } return secname; }
java
public static String getName() { String secname = null; WSCredential credential = getCallerWSCredential(); try { if (credential != null && !credential.isUnauthenticated()) { String realmSecname = credential.getRealmSecurityName(); if (realmSecname != null && !realmSecname.isEmpty()) { secname = realmSecname.substring(realmSecname.lastIndexOf(REALM_SEPARATOR) + 1); } } } catch (Exception e) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) Tr.debug(tc, "Internal error: " + e); } return secname; }
[ "public", "static", "String", "getName", "(", ")", "{", "String", "secname", "=", "null", ";", "WSCredential", "credential", "=", "getCallerWSCredential", "(", ")", ";", "try", "{", "if", "(", "credential", "!=", "null", "&&", "!", "credential", ".", "isUnauthenticated", "(", ")", ")", "{", "String", "realmSecname", "=", "credential", ".", "getRealmSecurityName", "(", ")", ";", "if", "(", "realmSecname", "!=", "null", "&&", "!", "realmSecname", ".", "isEmpty", "(", ")", ")", "{", "secname", "=", "realmSecname", ".", "substring", "(", "realmSecname", ".", "lastIndexOf", "(", "REALM_SEPARATOR", ")", "+", "1", ")", ";", "}", "}", "}", "catch", "(", "Exception", "e", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "Tr", ".", "debug", "(", "tc", ",", "\"Internal error: \"", "+", "e", ")", ";", "}", "return", "secname", ";", "}" ]
Return the security name of the current subject on the thread @return the security name id, or null if there is no subject or no WSCredential
[ "Return", "the", "security", "name", "of", "the", "current", "subject", "on", "the", "thread" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.websphere.security/src/com/ibm/ws/security/core/SecurityContext.java#L45-L60
train
OpenLiberty/open-liberty
dev/com.ibm.websphere.security/src/com/ibm/ws/security/core/SecurityContext.java
SecurityContext.getUser
public static String getUser() { String accessid = null; WSCredential credential = getCallerWSCredential(); try { if (credential != null && !credential.isUnauthenticated()) accessid = credential.getAccessId(); } catch (Exception e) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) Tr.debug(tc, "Internal error: " + e); } return accessid; }
java
public static String getUser() { String accessid = null; WSCredential credential = getCallerWSCredential(); try { if (credential != null && !credential.isUnauthenticated()) accessid = credential.getAccessId(); } catch (Exception e) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) Tr.debug(tc, "Internal error: " + e); } return accessid; }
[ "public", "static", "String", "getUser", "(", ")", "{", "String", "accessid", "=", "null", ";", "WSCredential", "credential", "=", "getCallerWSCredential", "(", ")", ";", "try", "{", "if", "(", "credential", "!=", "null", "&&", "!", "credential", ".", "isUnauthenticated", "(", ")", ")", "accessid", "=", "credential", ".", "getAccessId", "(", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "Tr", ".", "debug", "(", "tc", ",", "\"Internal error: \"", "+", "e", ")", ";", "}", "return", "accessid", ";", "}" ]
Return the accessid of the current subject on the thread @return the access id, or null if there is no subject or no WSCredential
[ "Return", "the", "accessid", "of", "the", "current", "subject", "on", "the", "thread" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.websphere.security/src/com/ibm/ws/security/core/SecurityContext.java#L67-L79
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/matchspace/selector/impl/XPath10EvaluatorImpl.java
XPath10EvaluatorImpl.compareListValues
private Boolean compareListValues( // was BooleanValue Object firstVal, Object secondVal, boolean lessThan, boolean permissive, boolean overallTrue) // If true we are searching for at least one TRUE result, else at least one FALSE. { if (tc.isAnyTracingEnabled() && tc.isEntryEnabled()) tc.entry(cclass, "compareListValues", new Object[] { firstVal, secondVal, new Boolean(lessThan), new Boolean(permissive), new Boolean(overallTrue) }); Boolean finalReturn = null; // Drive the compare() method Boolean compReturn = compare(firstVal, secondVal, lessThan, permissive); if(compReturn != null) { if(overallTrue) { if (compReturn.equals(Boolean.TRUE)) { // We've found a pair that meet the criteria finalReturn = Boolean.TRUE; } } else { if (compReturn.equals(Boolean.FALSE)) { // We've found a pair that meet the criteria finalReturn = Boolean.TRUE; } } } if (tc.isAnyTracingEnabled() && tc.isEntryEnabled()) tc.exit(cclass, "compareListValues", finalReturn); return finalReturn; }
java
private Boolean compareListValues( // was BooleanValue Object firstVal, Object secondVal, boolean lessThan, boolean permissive, boolean overallTrue) // If true we are searching for at least one TRUE result, else at least one FALSE. { if (tc.isAnyTracingEnabled() && tc.isEntryEnabled()) tc.entry(cclass, "compareListValues", new Object[] { firstVal, secondVal, new Boolean(lessThan), new Boolean(permissive), new Boolean(overallTrue) }); Boolean finalReturn = null; // Drive the compare() method Boolean compReturn = compare(firstVal, secondVal, lessThan, permissive); if(compReturn != null) { if(overallTrue) { if (compReturn.equals(Boolean.TRUE)) { // We've found a pair that meet the criteria finalReturn = Boolean.TRUE; } } else { if (compReturn.equals(Boolean.FALSE)) { // We've found a pair that meet the criteria finalReturn = Boolean.TRUE; } } } if (tc.isAnyTracingEnabled() && tc.isEntryEnabled()) tc.exit(cclass, "compareListValues", finalReturn); return finalReturn; }
[ "private", "Boolean", "compareListValues", "(", "// was BooleanValue", "Object", "firstVal", ",", "Object", "secondVal", ",", "boolean", "lessThan", ",", "boolean", "permissive", ",", "boolean", "overallTrue", ")", "// If true we are searching for at least one TRUE result, else at least one FALSE.", "{", "if", "(", "tc", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "tc", ".", "entry", "(", "cclass", ",", "\"compareListValues\"", ",", "new", "Object", "[", "]", "{", "firstVal", ",", "secondVal", ",", "new", "Boolean", "(", "lessThan", ")", ",", "new", "Boolean", "(", "permissive", ")", ",", "new", "Boolean", "(", "overallTrue", ")", "}", ")", ";", "Boolean", "finalReturn", "=", "null", ";", "// Drive the compare() method", "Boolean", "compReturn", "=", "compare", "(", "firstVal", ",", "secondVal", ",", "lessThan", ",", "permissive", ")", ";", "if", "(", "compReturn", "!=", "null", ")", "{", "if", "(", "overallTrue", ")", "{", "if", "(", "compReturn", ".", "equals", "(", "Boolean", ".", "TRUE", ")", ")", "{", "// We've found a pair that meet the criteria", "finalReturn", "=", "Boolean", ".", "TRUE", ";", "}", "}", "else", "{", "if", "(", "compReturn", ".", "equals", "(", "Boolean", ".", "FALSE", ")", ")", "{", "// We've found a pair that meet the criteria", "finalReturn", "=", "Boolean", ".", "TRUE", ";", "}", "}", "}", "if", "(", "tc", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "tc", ".", "exit", "(", "cclass", ",", "\"compareListValues\"", ",", "finalReturn", ")", ";", "return", "finalReturn", ";", "}" ]
Evaluate a comparison between 2 values at least one of which will be from a list. If we can determine that there is a matching pair then we return TRUE. @param firstVal @param secondVal @param lessThan @param permissive @param overallTrue @return
[ "Evaluate", "a", "comparison", "between", "2", "values", "at", "least", "one", "of", "which", "will", "be", "from", "a", "list", ".", "If", "we", "can", "determine", "that", "there", "is", "a", "matching", "pair", "then", "we", "return", "TRUE", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/matchspace/selector/impl/XPath10EvaluatorImpl.java#L258-L300
train
OpenLiberty/open-liberty
dev/com.ibm.ws.repository/src/com/ibm/ws/repository/connections/RestRepositoryConnectionProxy.java
RestRepositoryConnectionProxy.setURL
private URL setURL(URL url) throws RepositoryIllegalArgumentException { int port = url.getPort(); if (port == -1) { throw new RepositoryIllegalArgumentException("Bad proxy URL", new IllegalArgumentException("Proxy URL does not contain a port")); } String host = url.getHost(); if (host.equals("")) { throw new RepositoryIllegalArgumentException("Bad proxy URL", new IllegalArgumentException("Proxy URL does not contain a host")); } return url; }
java
private URL setURL(URL url) throws RepositoryIllegalArgumentException { int port = url.getPort(); if (port == -1) { throw new RepositoryIllegalArgumentException("Bad proxy URL", new IllegalArgumentException("Proxy URL does not contain a port")); } String host = url.getHost(); if (host.equals("")) { throw new RepositoryIllegalArgumentException("Bad proxy URL", new IllegalArgumentException("Proxy URL does not contain a host")); } return url; }
[ "private", "URL", "setURL", "(", "URL", "url", ")", "throws", "RepositoryIllegalArgumentException", "{", "int", "port", "=", "url", ".", "getPort", "(", ")", ";", "if", "(", "port", "==", "-", "1", ")", "{", "throw", "new", "RepositoryIllegalArgumentException", "(", "\"Bad proxy URL\"", ",", "new", "IllegalArgumentException", "(", "\"Proxy URL does not contain a port\"", ")", ")", ";", "}", "String", "host", "=", "url", ".", "getHost", "(", ")", ";", "if", "(", "host", ".", "equals", "(", "\"\"", ")", ")", "{", "throw", "new", "RepositoryIllegalArgumentException", "(", "\"Bad proxy URL\"", ",", "new", "IllegalArgumentException", "(", "\"Proxy URL does not contain a host\"", ")", ")", ";", "}", "return", "url", ";", "}" ]
Rather than setting the port directly, verify that the proxy URL did contain a port and throw an exception if it did not. This avoids problems later. @param url @return
[ "Rather", "than", "setting", "the", "port", "directly", "verify", "that", "the", "proxy", "URL", "did", "contain", "a", "port", "and", "throw", "an", "exception", "if", "it", "did", "not", ".", "This", "avoids", "problems", "later", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.repository/src/com/ibm/ws/repository/connections/RestRepositoryConnectionProxy.java#L60-L70
train
OpenLiberty/open-liberty
dev/com.ibm.ws.jmx/src/com/ibm/ws/jmx/internal/DelayedMBeanActivatorHelper.java
DelayedMBeanActivatorHelper.setMBean
protected void setMBean(ServiceReference<?> ref) { // Use "jmx.objectname" for determining the ObjectName to be consistent with Apache Aries. Object jmxObjectName = ref.getProperty("jmx.objectname"); if (jmxObjectName instanceof String) { try { // Construct an ObjectName from the "jmx.objectname" property and register the MBean. ObjectName name = new ObjectName((String) jmxObjectName); setServiceReferenceInternal(ref, name); } catch (MalformedObjectNameException e) { // One of our MBeans had a bad ObjectName. // TODO: trace, FFDC? } } else { // REVISIT: "jmx.objectname" was not specified or was not in // the right format. Ignoring this MBean for now since we don't // have an ObjectName. Possible that this MBean is a // javax.management.MBeanRegistration, do we want to try to // register it that way? } }
java
protected void setMBean(ServiceReference<?> ref) { // Use "jmx.objectname" for determining the ObjectName to be consistent with Apache Aries. Object jmxObjectName = ref.getProperty("jmx.objectname"); if (jmxObjectName instanceof String) { try { // Construct an ObjectName from the "jmx.objectname" property and register the MBean. ObjectName name = new ObjectName((String) jmxObjectName); setServiceReferenceInternal(ref, name); } catch (MalformedObjectNameException e) { // One of our MBeans had a bad ObjectName. // TODO: trace, FFDC? } } else { // REVISIT: "jmx.objectname" was not specified or was not in // the right format. Ignoring this MBean for now since we don't // have an ObjectName. Possible that this MBean is a // javax.management.MBeanRegistration, do we want to try to // register it that way? } }
[ "protected", "void", "setMBean", "(", "ServiceReference", "<", "?", ">", "ref", ")", "{", "// Use \"jmx.objectname\" for determining the ObjectName to be consistent with Apache Aries.", "Object", "jmxObjectName", "=", "ref", ".", "getProperty", "(", "\"jmx.objectname\"", ")", ";", "if", "(", "jmxObjectName", "instanceof", "String", ")", "{", "try", "{", "// Construct an ObjectName from the \"jmx.objectname\" property and register the MBean.", "ObjectName", "name", "=", "new", "ObjectName", "(", "(", "String", ")", "jmxObjectName", ")", ";", "setServiceReferenceInternal", "(", "ref", ",", "name", ")", ";", "}", "catch", "(", "MalformedObjectNameException", "e", ")", "{", "// One of our MBeans had a bad ObjectName.", "// TODO: trace, FFDC?", "}", "}", "else", "{", "// REVISIT: \"jmx.objectname\" was not specified or was not in", "// the right format. Ignoring this MBean for now since we don't", "// have an ObjectName. Possible that this MBean is a", "// javax.management.MBeanRegistration, do we want to try to", "// register it that way?", "}", "}" ]
Sets the reference to a dynamic MBean.
[ "Sets", "the", "reference", "to", "a", "dynamic", "MBean", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jmx/src/com/ibm/ws/jmx/internal/DelayedMBeanActivatorHelper.java#L89-L108
train
OpenLiberty/open-liberty
dev/com.ibm.ws.channelfw/src/com/ibm/ws/bytebuffer/internal/WsByteBufferImpl.java
WsByteBufferImpl.printStackToDebug
public void printStackToDebug() { Throwable t = new Throwable(); StackTraceElement[] ste = t.getStackTrace(); int start = (ste.length > 6) ? 6 : ste.length; for (int i = start; i >= 1; i--) { Tr.debug(tc, "Calling Stack Element[" + i + "]: " + ste[i]); } }
java
public void printStackToDebug() { Throwable t = new Throwable(); StackTraceElement[] ste = t.getStackTrace(); int start = (ste.length > 6) ? 6 : ste.length; for (int i = start; i >= 1; i--) { Tr.debug(tc, "Calling Stack Element[" + i + "]: " + ste[i]); } }
[ "public", "void", "printStackToDebug", "(", ")", "{", "Throwable", "t", "=", "new", "Throwable", "(", ")", ";", "StackTraceElement", "[", "]", "ste", "=", "t", ".", "getStackTrace", "(", ")", ";", "int", "start", "=", "(", "ste", ".", "length", ">", "6", ")", "?", "6", ":", "ste", ".", "length", ";", "for", "(", "int", "i", "=", "start", ";", "i", ">=", "1", ";", "i", "--", ")", "{", "Tr", ".", "debug", "(", "tc", ",", "\"Calling Stack Element[\"", "+", "i", "+", "\"]: \"", "+", "ste", "[", "i", "]", ")", ";", "}", "}" ]
Debug method to print part of the current stack.
[ "Debug", "method", "to", "print", "part", "of", "the", "current", "stack", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.channelfw/src/com/ibm/ws/bytebuffer/internal/WsByteBufferImpl.java#L1594-L1602
train
OpenLiberty/open-liberty
dev/com.ibm.ws.channelfw/src/com/ibm/ws/bytebuffer/internal/WsByteBufferImpl.java
WsByteBufferImpl.setPoolManagerRef
public void setPoolManagerRef(WsByteBufferPoolManagerImpl oManagerRef) { this.oWsByteBufferPoolManager = oManagerRef; this.trusted = oManagerRef.isTrustedUsers(); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "setPoolManagerRef: trusted=" + this.trusted); } }
java
public void setPoolManagerRef(WsByteBufferPoolManagerImpl oManagerRef) { this.oWsByteBufferPoolManager = oManagerRef; this.trusted = oManagerRef.isTrustedUsers(); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "setPoolManagerRef: trusted=" + this.trusted); } }
[ "public", "void", "setPoolManagerRef", "(", "WsByteBufferPoolManagerImpl", "oManagerRef", ")", "{", "this", ".", "oWsByteBufferPoolManager", "=", "oManagerRef", ";", "this", ".", "trusted", "=", "oManagerRef", ".", "isTrustedUsers", "(", ")", ";", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "{", "Tr", ".", "debug", "(", "tc", ",", "\"setPoolManagerRef: trusted=\"", "+", "this", ".", "trusted", ")", ";", "}", "}" ]
Set the PoolManager reference. @param oManagerRef
[ "Set", "the", "PoolManager", "reference", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.channelfw/src/com/ibm/ws/bytebuffer/internal/WsByteBufferImpl.java#L1727-L1734
train
OpenLiberty/open-liberty
dev/com.ibm.ws.channelfw/src/com/ibm/ws/bytebuffer/internal/WsByteBufferImpl.java
WsByteBufferImpl.setDirectShadowBuffer
public void setDirectShadowBuffer(ByteBuffer buffer) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.entry(tc, "setDirectShadowBuffer"); } if (!this.trusted) checkValidity(); this.oWsBBDirect = buffer; if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.exit(tc, "setDirectShadowBuffer"); } }
java
public void setDirectShadowBuffer(ByteBuffer buffer) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.entry(tc, "setDirectShadowBuffer"); } if (!this.trusted) checkValidity(); this.oWsBBDirect = buffer; if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.exit(tc, "setDirectShadowBuffer"); } }
[ "public", "void", "setDirectShadowBuffer", "(", "ByteBuffer", "buffer", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "{", "Tr", ".", "entry", "(", "tc", ",", "\"setDirectShadowBuffer\"", ")", ";", "}", "if", "(", "!", "this", ".", "trusted", ")", "checkValidity", "(", ")", ";", "this", ".", "oWsBBDirect", "=", "buffer", ";", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "{", "Tr", ".", "exit", "(", "tc", ",", "\"setDirectShadowBuffer\"", ")", ";", "}", "}" ]
Set the direct bytebuffer that backs an indirect heap buffer to the input buffer. @param buffer
[ "Set", "the", "direct", "bytebuffer", "that", "backs", "an", "indirect", "heap", "buffer", "to", "the", "input", "buffer", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.channelfw/src/com/ibm/ws/bytebuffer/internal/WsByteBufferImpl.java#L1772-L1785
train
OpenLiberty/open-liberty
dev/com.ibm.ws.channelfw/src/com/ibm/ws/bytebuffer/internal/WsByteBufferImpl.java
WsByteBufferImpl.setParmsToDirectBuffer
public void setParmsToDirectBuffer() { if (oByteBuffer.isDirect()) { this.oWsBBDirect = this.oByteBuffer; return; } if (oWsBBDirect == null) { this.oWsBBDirect = ByteBuffer.allocateDirect(oByteBuffer.capacity()); } // set the position and limit this.oWsBBDirect.limit(oByteBuffer.limit()); this.oWsBBDirect.position(oByteBuffer.position()); }
java
public void setParmsToDirectBuffer() { if (oByteBuffer.isDirect()) { this.oWsBBDirect = this.oByteBuffer; return; } if (oWsBBDirect == null) { this.oWsBBDirect = ByteBuffer.allocateDirect(oByteBuffer.capacity()); } // set the position and limit this.oWsBBDirect.limit(oByteBuffer.limit()); this.oWsBBDirect.position(oByteBuffer.position()); }
[ "public", "void", "setParmsToDirectBuffer", "(", ")", "{", "if", "(", "oByteBuffer", ".", "isDirect", "(", ")", ")", "{", "this", ".", "oWsBBDirect", "=", "this", ".", "oByteBuffer", ";", "return", ";", "}", "if", "(", "oWsBBDirect", "==", "null", ")", "{", "this", ".", "oWsBBDirect", "=", "ByteBuffer", ".", "allocateDirect", "(", "oByteBuffer", ".", "capacity", "(", ")", ")", ";", "}", "// set the position and limit", "this", ".", "oWsBBDirect", ".", "limit", "(", "oByteBuffer", ".", "limit", "(", ")", ")", ";", "this", ".", "oWsBBDirect", ".", "position", "(", "oByteBuffer", ".", "position", "(", ")", ")", ";", "}" ]
Copy the buffer parameters from the indirect to the backing direct buffer, if necessary.
[ "Copy", "the", "buffer", "parameters", "from", "the", "indirect", "to", "the", "backing", "direct", "buffer", "if", "necessary", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.channelfw/src/com/ibm/ws/bytebuffer/internal/WsByteBufferImpl.java#L2040-L2054
train
OpenLiberty/open-liberty
dev/com.ibm.ws.jmx.connector.server.rest/src/com/ibm/ws/jmx/connector/server/rest/handlers/FileStatusHostStatusHandler.java
FileStatusHostStatusHandler.taskHostStatus
private void taskHostStatus(RESTRequest request, RESTResponse response) { String taskID = RESTHelper.getRequiredParam(request, APIConstants.PARAM_TASK_ID); String host = RESTHelper.getRequiredParam(request, APIConstants.PARAM_HOST); String taskHostStatusJson = getMultipleRoutingHelper().getHostDetails(taskID, host); OutputHelper.writeJsonOutput(response, taskHostStatusJson); }
java
private void taskHostStatus(RESTRequest request, RESTResponse response) { String taskID = RESTHelper.getRequiredParam(request, APIConstants.PARAM_TASK_ID); String host = RESTHelper.getRequiredParam(request, APIConstants.PARAM_HOST); String taskHostStatusJson = getMultipleRoutingHelper().getHostDetails(taskID, host); OutputHelper.writeJsonOutput(response, taskHostStatusJson); }
[ "private", "void", "taskHostStatus", "(", "RESTRequest", "request", ",", "RESTResponse", "response", ")", "{", "String", "taskID", "=", "RESTHelper", ".", "getRequiredParam", "(", "request", ",", "APIConstants", ".", "PARAM_TASK_ID", ")", ";", "String", "host", "=", "RESTHelper", ".", "getRequiredParam", "(", "request", ",", "APIConstants", ".", "PARAM_HOST", ")", ";", "String", "taskHostStatusJson", "=", "getMultipleRoutingHelper", "(", ")", ".", "getHostDetails", "(", "taskID", ",", "host", ")", ";", "OutputHelper", ".", "writeJsonOutput", "(", "response", ",", "taskHostStatusJson", ")", ";", "}" ]
Returns a JSON array of CommandResult serialization, representing the steps taken in that host [ { "timestamp" : String, "status" : String, "description" : String, "returnCode" : int, "StdOut" : String, "StdErr" : String }* ]
[ "Returns", "a", "JSON", "array", "of", "CommandResult", "serialization", "representing", "the", "steps", "taken", "in", "that", "host" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jmx.connector.server.rest/src/com/ibm/ws/jmx/connector/server/rest/handlers/FileStatusHostStatusHandler.java#L110-L116
train
OpenLiberty/open-liberty
dev/com.ibm.ws.app.manager.war/src/com/ibm/ws/app/manager/ear/internal/EARDeployedAppInfoFactoryImpl.java
EARDeployedAppInfoFactoryImpl.prepareExpansion
protected void prepareExpansion() throws IOException { WsResource expansionResource = deployedAppServices.getLocationAdmin().resolveResource(AppManagerConstants.EXPANDED_APPS_DIR); expansionResource.create(); }
java
protected void prepareExpansion() throws IOException { WsResource expansionResource = deployedAppServices.getLocationAdmin().resolveResource(AppManagerConstants.EXPANDED_APPS_DIR); expansionResource.create(); }
[ "protected", "void", "prepareExpansion", "(", ")", "throws", "IOException", "{", "WsResource", "expansionResource", "=", "deployedAppServices", ".", "getLocationAdmin", "(", ")", ".", "resolveResource", "(", "AppManagerConstants", ".", "EXPANDED_APPS_DIR", ")", ";", "expansionResource", ".", "create", "(", ")", ";", "}" ]
Application expansion ...
[ "Application", "expansion", "..." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.app.manager.war/src/com/ibm/ws/app/manager/ear/internal/EARDeployedAppInfoFactoryImpl.java#L148-L151
train
OpenLiberty/open-liberty
dev/com.ibm.ws.app.manager.war/src/com/ibm/ws/app/manager/ear/internal/EARDeployedAppInfoFactoryImpl.java
EARDeployedAppInfoFactoryImpl.createDeployedAppInfo
@Override public DeployedAppInfo createDeployedAppInfo(ApplicationInformation<DeployedAppInfo> appInfo) throws UnableToAdaptException { String appPid = appInfo.getPid(); String appName = appInfo.getName(); String appPath = appInfo.getLocation(); File appFile = new File(appPath); Tr.debug(_tc, "Create deployed application:" + " PID [ " + appPid + " ]" + " Name [ " + appName + " ]" + " Location [ " + appPath + " ]"); Container appContainer = appInfo.getContainer(); Container originalAppContainer = null; // If enabled by an attribute of the application manager configuration, // expand the application. // // Expansion is possible if the application file is not already a directory, and is // not loosely configuration. if ( applicationManager.getExpandApps() && isArchive(appFile, appPath) ) { try { prepareExpansion(); WsResource expandedResource = resolveExpansion(appName); File expandedFile = expandedResource.asFile(); expand(appName, appFile, expandedResource, expandedFile); originalAppContainer = appContainer; appContainer = deployedAppServices.setupContainer(appPid, expandedFile); } catch ( IOException e ) { Tr.error(_tc, "warning.could.not.expand.application", appName, e.getMessage()); } } Application applicationDD; try { applicationDD = appContainer.adapt(Application.class); // throws UnableToAdaptException // Null when there is no application descriptor. } catch ( UnableToAdaptException e ) { // CWWKZ0113E: Application {0}: Parse error for application descriptor {1}: {2} Tr.error(_tc, "error.application.parse.descriptor", appName, "META-INF/application.xml", e); throw e; } InterpretedContainer jeeContainer; if ( appContainer instanceof InterpretedContainer ) { jeeContainer = (InterpretedContainer) appContainer; } else { jeeContainer = appContainer.adapt(InterpretedContainer.class); } // Set a structure helper for modules that might be expanded inside // (e.g., x.ear/y.war or x.ear/y.jar/). if ( applicationDD == null ) { jeeContainer.setStructureHelper( EARStructureHelper.getUnknownRootInstance() ); } else { List<String> modulePaths = new ArrayList<String>(); for ( Module module : applicationDD.getModules() ) { modulePaths.add( module.getModulePath() ); } jeeContainer.setStructureHelper( EARStructureHelper.create(modulePaths) ); } appInfo.setContainer(jeeContainer); EARDeployedAppInfo deployedApp = new EARDeployedAppInfo(appInfo, applicationDD, this, deployedAppServices, originalAppContainer); appInfo.setHandlerInfo(deployedApp); return deployedApp; }
java
@Override public DeployedAppInfo createDeployedAppInfo(ApplicationInformation<DeployedAppInfo> appInfo) throws UnableToAdaptException { String appPid = appInfo.getPid(); String appName = appInfo.getName(); String appPath = appInfo.getLocation(); File appFile = new File(appPath); Tr.debug(_tc, "Create deployed application:" + " PID [ " + appPid + " ]" + " Name [ " + appName + " ]" + " Location [ " + appPath + " ]"); Container appContainer = appInfo.getContainer(); Container originalAppContainer = null; // If enabled by an attribute of the application manager configuration, // expand the application. // // Expansion is possible if the application file is not already a directory, and is // not loosely configuration. if ( applicationManager.getExpandApps() && isArchive(appFile, appPath) ) { try { prepareExpansion(); WsResource expandedResource = resolveExpansion(appName); File expandedFile = expandedResource.asFile(); expand(appName, appFile, expandedResource, expandedFile); originalAppContainer = appContainer; appContainer = deployedAppServices.setupContainer(appPid, expandedFile); } catch ( IOException e ) { Tr.error(_tc, "warning.could.not.expand.application", appName, e.getMessage()); } } Application applicationDD; try { applicationDD = appContainer.adapt(Application.class); // throws UnableToAdaptException // Null when there is no application descriptor. } catch ( UnableToAdaptException e ) { // CWWKZ0113E: Application {0}: Parse error for application descriptor {1}: {2} Tr.error(_tc, "error.application.parse.descriptor", appName, "META-INF/application.xml", e); throw e; } InterpretedContainer jeeContainer; if ( appContainer instanceof InterpretedContainer ) { jeeContainer = (InterpretedContainer) appContainer; } else { jeeContainer = appContainer.adapt(InterpretedContainer.class); } // Set a structure helper for modules that might be expanded inside // (e.g., x.ear/y.war or x.ear/y.jar/). if ( applicationDD == null ) { jeeContainer.setStructureHelper( EARStructureHelper.getUnknownRootInstance() ); } else { List<String> modulePaths = new ArrayList<String>(); for ( Module module : applicationDD.getModules() ) { modulePaths.add( module.getModulePath() ); } jeeContainer.setStructureHelper( EARStructureHelper.create(modulePaths) ); } appInfo.setContainer(jeeContainer); EARDeployedAppInfo deployedApp = new EARDeployedAppInfo(appInfo, applicationDD, this, deployedAppServices, originalAppContainer); appInfo.setHandlerInfo(deployedApp); return deployedApp; }
[ "@", "Override", "public", "DeployedAppInfo", "createDeployedAppInfo", "(", "ApplicationInformation", "<", "DeployedAppInfo", ">", "appInfo", ")", "throws", "UnableToAdaptException", "{", "String", "appPid", "=", "appInfo", ".", "getPid", "(", ")", ";", "String", "appName", "=", "appInfo", ".", "getName", "(", ")", ";", "String", "appPath", "=", "appInfo", ".", "getLocation", "(", ")", ";", "File", "appFile", "=", "new", "File", "(", "appPath", ")", ";", "Tr", ".", "debug", "(", "_tc", ",", "\"Create deployed application:\"", "+", "\" PID [ \"", "+", "appPid", "+", "\" ]\"", "+", "\" Name [ \"", "+", "appName", "+", "\" ]\"", "+", "\" Location [ \"", "+", "appPath", "+", "\" ]\"", ")", ";", "Container", "appContainer", "=", "appInfo", ".", "getContainer", "(", ")", ";", "Container", "originalAppContainer", "=", "null", ";", "// If enabled by an attribute of the application manager configuration,", "// expand the application.", "//", "// Expansion is possible if the application file is not already a directory, and is", "// not loosely configuration.", "if", "(", "applicationManager", ".", "getExpandApps", "(", ")", "&&", "isArchive", "(", "appFile", ",", "appPath", ")", ")", "{", "try", "{", "prepareExpansion", "(", ")", ";", "WsResource", "expandedResource", "=", "resolveExpansion", "(", "appName", ")", ";", "File", "expandedFile", "=", "expandedResource", ".", "asFile", "(", ")", ";", "expand", "(", "appName", ",", "appFile", ",", "expandedResource", ",", "expandedFile", ")", ";", "originalAppContainer", "=", "appContainer", ";", "appContainer", "=", "deployedAppServices", ".", "setupContainer", "(", "appPid", ",", "expandedFile", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "Tr", ".", "error", "(", "_tc", ",", "\"warning.could.not.expand.application\"", ",", "appName", ",", "e", ".", "getMessage", "(", ")", ")", ";", "}", "}", "Application", "applicationDD", ";", "try", "{", "applicationDD", "=", "appContainer", ".", "adapt", "(", "Application", ".", "class", ")", ";", "// throws UnableToAdaptException", "// Null when there is no application descriptor.", "}", "catch", "(", "UnableToAdaptException", "e", ")", "{", "// CWWKZ0113E: Application {0}: Parse error for application descriptor {1}: {2}", "Tr", ".", "error", "(", "_tc", ",", "\"error.application.parse.descriptor\"", ",", "appName", ",", "\"META-INF/application.xml\"", ",", "e", ")", ";", "throw", "e", ";", "}", "InterpretedContainer", "jeeContainer", ";", "if", "(", "appContainer", "instanceof", "InterpretedContainer", ")", "{", "jeeContainer", "=", "(", "InterpretedContainer", ")", "appContainer", ";", "}", "else", "{", "jeeContainer", "=", "appContainer", ".", "adapt", "(", "InterpretedContainer", ".", "class", ")", ";", "}", "// Set a structure helper for modules that might be expanded inside", "// (e.g., x.ear/y.war or x.ear/y.jar/).", "if", "(", "applicationDD", "==", "null", ")", "{", "jeeContainer", ".", "setStructureHelper", "(", "EARStructureHelper", ".", "getUnknownRootInstance", "(", ")", ")", ";", "}", "else", "{", "List", "<", "String", ">", "modulePaths", "=", "new", "ArrayList", "<", "String", ">", "(", ")", ";", "for", "(", "Module", "module", ":", "applicationDD", ".", "getModules", "(", ")", ")", "{", "modulePaths", ".", "add", "(", "module", ".", "getModulePath", "(", ")", ")", ";", "}", "jeeContainer", ".", "setStructureHelper", "(", "EARStructureHelper", ".", "create", "(", "modulePaths", ")", ")", ";", "}", "appInfo", ".", "setContainer", "(", "jeeContainer", ")", ";", "EARDeployedAppInfo", "deployedApp", "=", "new", "EARDeployedAppInfo", "(", "appInfo", ",", "applicationDD", ",", "this", ",", "deployedAppServices", ",", "originalAppContainer", ")", ";", "appInfo", ".", "setHandlerInfo", "(", "deployedApp", ")", ";", "return", "deployedApp", ";", "}" ]
Create deployment information for a java enterprise application. A location must be specified for the application. The location must have an java enterprise application archive (an EAR file), an expanded enterprise archive, or an XML loose configuration file. If expansion is enabled, and if the application location holds an EAR file, expand the application to the expanded applications location. @param appInfo Information for the application for which to create deployment information. @return Deployment information for the application. @throws UnableToAdaptException Thrown if the deployment information count not be created.
[ "Create", "deployment", "information", "for", "a", "java", "enterprise", "application", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.app.manager.war/src/com/ibm/ws/app/manager/ear/internal/EARDeployedAppInfoFactoryImpl.java#L291-L365
train
OpenLiberty/open-liberty
dev/com.ibm.ws.security.social/src/com/ibm/ws/security/social/error/ErrorHandlerImpl.java
ErrorHandlerImpl.createCssContentString
protected String createCssContentString() { StringBuilder css = new StringBuilder(); css.append("<style>"); // body css.append("body {"); css.append("background-color: #152935;"); css.append("font-family: serif;"); css.append("margin: 0;"); css.append("}\n"); // #top, #bottom css.append("#top, #bottom {"); css.append("padding: 20px;"); css.append("}\n"); css.append(""); // #top-middle, #bottom-middle css.append("#top-middle, #bottom-middle {"); css.append("background-color: #001428;"); css.append("padding: 10px;"); css.append("}\n"); css.append(""); // .container css.append(".container {"); css.append("background-color: white;"); css.append("padding: 20px 50px;"); css.append("}\n"); // .error css.append(".error {"); css.append("color: red;"); css.append("font-weight: bold;"); css.append("}\n"); css.append("</style>"); return css.toString(); }
java
protected String createCssContentString() { StringBuilder css = new StringBuilder(); css.append("<style>"); // body css.append("body {"); css.append("background-color: #152935;"); css.append("font-family: serif;"); css.append("margin: 0;"); css.append("}\n"); // #top, #bottom css.append("#top, #bottom {"); css.append("padding: 20px;"); css.append("}\n"); css.append(""); // #top-middle, #bottom-middle css.append("#top-middle, #bottom-middle {"); css.append("background-color: #001428;"); css.append("padding: 10px;"); css.append("}\n"); css.append(""); // .container css.append(".container {"); css.append("background-color: white;"); css.append("padding: 20px 50px;"); css.append("}\n"); // .error css.append(".error {"); css.append("color: red;"); css.append("font-weight: bold;"); css.append("}\n"); css.append("</style>"); return css.toString(); }
[ "protected", "String", "createCssContentString", "(", ")", "{", "StringBuilder", "css", "=", "new", "StringBuilder", "(", ")", ";", "css", ".", "append", "(", "\"<style>\"", ")", ";", "// body", "css", ".", "append", "(", "\"body {\"", ")", ";", "css", ".", "append", "(", "\"background-color: #152935;\"", ")", ";", "css", ".", "append", "(", "\"font-family: serif;\"", ")", ";", "css", ".", "append", "(", "\"margin: 0;\"", ")", ";", "css", ".", "append", "(", "\"}\\n\"", ")", ";", "// #top, #bottom", "css", ".", "append", "(", "\"#top, #bottom {\"", ")", ";", "css", ".", "append", "(", "\"padding: 20px;\"", ")", ";", "css", ".", "append", "(", "\"}\\n\"", ")", ";", "css", ".", "append", "(", "\"\"", ")", ";", "// #top-middle, #bottom-middle", "css", ".", "append", "(", "\"#top-middle, #bottom-middle {\"", ")", ";", "css", ".", "append", "(", "\"background-color: #001428;\"", ")", ";", "css", ".", "append", "(", "\"padding: 10px;\"", ")", ";", "css", ".", "append", "(", "\"}\\n\"", ")", ";", "css", ".", "append", "(", "\"\"", ")", ";", "// .container", "css", ".", "append", "(", "\".container {\"", ")", ";", "css", ".", "append", "(", "\"background-color: white;\"", ")", ";", "css", ".", "append", "(", "\"padding: 20px 50px;\"", ")", ";", "css", ".", "append", "(", "\"}\\n\"", ")", ";", "// .error", "css", ".", "append", "(", "\".error {\"", ")", ";", "css", ".", "append", "(", "\"color: red;\"", ")", ";", "css", ".", "append", "(", "\"font-weight: bold;\"", ")", ";", "css", ".", "append", "(", "\"}\\n\"", ")", ";", "css", ".", "append", "(", "\"</style>\"", ")", ";", "return", "css", ".", "toString", "(", ")", ";", "}" ]
Creates the CSS content string to be used to format page. @return
[ "Creates", "the", "CSS", "content", "string", "to", "be", "used", "to", "format", "page", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.social/src/com/ibm/ws/security/social/error/ErrorHandlerImpl.java#L117-L151
train
OpenLiberty/open-liberty
dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/internal/outbound/HttpOSCReadCallback.java
HttpOSCReadCallback.complete
public void complete(VirtualConnection vc, TCPReadRequestContext req) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "complete() called: vc=" + vc); } HttpOutboundServiceContextImpl mySC = (HttpOutboundServiceContextImpl) vc.getStateMap().get(CallbackIDs.CALLBACK_HTTPOSC); // keep reading and handling new data until either we're done // parsing headers or until we're waiting on a read to finish VirtualConnection readVC = null; try { do { if (mySC.parseMessage()) { // start processing the new parsed message mySC.handleParsedMessage(); return; } // not done parsing, read for more data if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Reading for more data"); } // configure the buffers for reading mySC.setupReadBuffers(mySC.getHttpConfig().getIncomingHdrBufferSize(), false); readVC = req.read(1, this, false, mySC.getReadTimeout()); } while (null != readVC); } catch (Exception e) { FFDCFilter.processException(e, getClass().getName() + ".complete", "112", this); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Caught exception: " + e.getMessage()); } mySC.setPersistent(false); mySC.getAppWriteCallback().error(vc, e); } }
java
public void complete(VirtualConnection vc, TCPReadRequestContext req) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "complete() called: vc=" + vc); } HttpOutboundServiceContextImpl mySC = (HttpOutboundServiceContextImpl) vc.getStateMap().get(CallbackIDs.CALLBACK_HTTPOSC); // keep reading and handling new data until either we're done // parsing headers or until we're waiting on a read to finish VirtualConnection readVC = null; try { do { if (mySC.parseMessage()) { // start processing the new parsed message mySC.handleParsedMessage(); return; } // not done parsing, read for more data if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Reading for more data"); } // configure the buffers for reading mySC.setupReadBuffers(mySC.getHttpConfig().getIncomingHdrBufferSize(), false); readVC = req.read(1, this, false, mySC.getReadTimeout()); } while (null != readVC); } catch (Exception e) { FFDCFilter.processException(e, getClass().getName() + ".complete", "112", this); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Caught exception: " + e.getMessage()); } mySC.setPersistent(false); mySC.getAppWriteCallback().error(vc, e); } }
[ "public", "void", "complete", "(", "VirtualConnection", "vc", ",", "TCPReadRequestContext", "req", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "{", "Tr", ".", "debug", "(", "tc", ",", "\"complete() called: vc=\"", "+", "vc", ")", ";", "}", "HttpOutboundServiceContextImpl", "mySC", "=", "(", "HttpOutboundServiceContextImpl", ")", "vc", ".", "getStateMap", "(", ")", ".", "get", "(", "CallbackIDs", ".", "CALLBACK_HTTPOSC", ")", ";", "// keep reading and handling new data until either we're done", "// parsing headers or until we're waiting on a read to finish", "VirtualConnection", "readVC", "=", "null", ";", "try", "{", "do", "{", "if", "(", "mySC", ".", "parseMessage", "(", ")", ")", "{", "// start processing the new parsed message", "mySC", ".", "handleParsedMessage", "(", ")", ";", "return", ";", "}", "// not done parsing, read for more data", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "{", "Tr", ".", "debug", "(", "tc", ",", "\"Reading for more data\"", ")", ";", "}", "// configure the buffers for reading", "mySC", ".", "setupReadBuffers", "(", "mySC", ".", "getHttpConfig", "(", ")", ".", "getIncomingHdrBufferSize", "(", ")", ",", "false", ")", ";", "readVC", "=", "req", ".", "read", "(", "1", ",", "this", ",", "false", ",", "mySC", ".", "getReadTimeout", "(", ")", ")", ";", "}", "while", "(", "null", "!=", "readVC", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "FFDCFilter", ".", "processException", "(", "e", ",", "getClass", "(", ")", ".", "getName", "(", ")", "+", "\".complete\"", ",", "\"112\"", ",", "this", ")", ";", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "{", "Tr", ".", "debug", "(", "tc", ",", "\"Caught exception: \"", "+", "e", ".", "getMessage", "(", ")", ")", ";", "}", "mySC", ".", "setPersistent", "(", "false", ")", ";", "mySC", ".", "getAppWriteCallback", "(", ")", ".", "error", "(", "vc", ",", "e", ")", ";", "}", "}" ]
Called by the channel below us when a read has completed. @param vc @param req
[ "Called", "by", "the", "channel", "below", "us", "when", "a", "read", "has", "completed", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/internal/outbound/HttpOSCReadCallback.java#L59-L91
train
OpenLiberty/open-liberty
dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/internal/outbound/HttpOutboundServiceContextImpl.java
HttpOutboundServiceContextImpl.reConnect
protected void reConnect(VirtualConnection inVC, IOException ioe) { if (getLink().isReconnectAllowed()) { // start the reconnect if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Attempting reconnect: " + getLink().getVirtualConnection()); } // 359362 - null out the JIT read buffers getTSC().getReadInterface().setBuffer(null); getLink().reConnectAsync(ioe); } else { callErrorCallback(inVC, ioe); } }
java
protected void reConnect(VirtualConnection inVC, IOException ioe) { if (getLink().isReconnectAllowed()) { // start the reconnect if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Attempting reconnect: " + getLink().getVirtualConnection()); } // 359362 - null out the JIT read buffers getTSC().getReadInterface().setBuffer(null); getLink().reConnectAsync(ioe); } else { callErrorCallback(inVC, ioe); } }
[ "protected", "void", "reConnect", "(", "VirtualConnection", "inVC", ",", "IOException", "ioe", ")", "{", "if", "(", "getLink", "(", ")", ".", "isReconnectAllowed", "(", ")", ")", "{", "// start the reconnect", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "{", "Tr", ".", "debug", "(", "tc", ",", "\"Attempting reconnect: \"", "+", "getLink", "(", ")", ".", "getVirtualConnection", "(", ")", ")", ";", "}", "// 359362 - null out the JIT read buffers", "getTSC", "(", ")", ".", "getReadInterface", "(", ")", ".", "setBuffer", "(", "null", ")", ";", "getLink", "(", ")", ".", "reConnectAsync", "(", "ioe", ")", ";", "}", "else", "{", "callErrorCallback", "(", "inVC", ",", "ioe", ")", ";", "}", "}" ]
If an error occurs during an attempted write of an outgoing request message, this method will either reconnect for another try or pass the error up the channel chain. @param inVC @param ioe
[ "If", "an", "error", "occurs", "during", "an", "attempted", "write", "of", "an", "outgoing", "request", "message", "this", "method", "will", "either", "reconnect", "for", "another", "try", "or", "pass", "the", "error", "up", "the", "channel", "chain", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/internal/outbound/HttpOutboundServiceContextImpl.java#L213-L226
train
OpenLiberty/open-liberty
dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/internal/outbound/HttpOutboundServiceContextImpl.java
HttpOutboundServiceContextImpl.callErrorCallback
void callErrorCallback(VirtualConnection inVC, IOException ioe) { // otherwise pass the error along to the channel above us, or close // the connection if nobody is above setPersistent(false); if (this.bEarlyReads && null != getAppReadCallback()) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Early read failure calling error() on appside"); } getAppReadCallback().error(inVC, ioe); } else if (null != getAppWriteCallback()) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Calling write.error() on appside"); } getAppWriteCallback().error(inVC, ioe); } else { // nobody above us, just close the connection if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "No appside, closing connection"); } getLink().getDeviceLink().close(inVC, ioe); } }
java
void callErrorCallback(VirtualConnection inVC, IOException ioe) { // otherwise pass the error along to the channel above us, or close // the connection if nobody is above setPersistent(false); if (this.bEarlyReads && null != getAppReadCallback()) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Early read failure calling error() on appside"); } getAppReadCallback().error(inVC, ioe); } else if (null != getAppWriteCallback()) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Calling write.error() on appside"); } getAppWriteCallback().error(inVC, ioe); } else { // nobody above us, just close the connection if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "No appside, closing connection"); } getLink().getDeviceLink().close(inVC, ioe); } }
[ "void", "callErrorCallback", "(", "VirtualConnection", "inVC", ",", "IOException", "ioe", ")", "{", "// otherwise pass the error along to the channel above us, or close", "// the connection if nobody is above", "setPersistent", "(", "false", ")", ";", "if", "(", "this", ".", "bEarlyReads", "&&", "null", "!=", "getAppReadCallback", "(", ")", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "{", "Tr", ".", "debug", "(", "tc", ",", "\"Early read failure calling error() on appside\"", ")", ";", "}", "getAppReadCallback", "(", ")", ".", "error", "(", "inVC", ",", "ioe", ")", ";", "}", "else", "if", "(", "null", "!=", "getAppWriteCallback", "(", ")", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "{", "Tr", ".", "debug", "(", "tc", ",", "\"Calling write.error() on appside\"", ")", ";", "}", "getAppWriteCallback", "(", ")", ".", "error", "(", "inVC", ",", "ioe", ")", ";", "}", "else", "{", "// nobody above us, just close the connection", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "{", "Tr", ".", "debug", "(", "tc", ",", "\"No appside, closing connection\"", ")", ";", "}", "getLink", "(", ")", ".", "getDeviceLink", "(", ")", ".", "close", "(", "inVC", ",", "ioe", ")", ";", "}", "}" ]
Call the error callback of the app above. @param inVC @param ioe
[ "Call", "the", "error", "callback", "of", "the", "app", "above", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/internal/outbound/HttpOutboundServiceContextImpl.java#L234-L255
train
OpenLiberty/open-liberty
dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/internal/outbound/HttpOutboundServiceContextImpl.java
HttpOutboundServiceContextImpl.resetWriteBuffers
private boolean resetWriteBuffers() { int stop = getPendingStop(); WsByteBuffer[] list = getPendingBuffers(); // verify we can actually attempt the re-write if (null == this.positionList || null == list) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Error in resetBuffers: posList: " + this.positionList + " list: " + list); } getTSC().getWriteInterface().setBuffer(null); return false; } // reset positions in each of the buffers for (int i = 0; i < stop; i++) { list[i].position(this.positionList[i]); } getTSC().getWriteInterface().setBuffers(list); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Reset positions on (" + stop + ") write buffers"); } return true; }
java
private boolean resetWriteBuffers() { int stop = getPendingStop(); WsByteBuffer[] list = getPendingBuffers(); // verify we can actually attempt the re-write if (null == this.positionList || null == list) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Error in resetBuffers: posList: " + this.positionList + " list: " + list); } getTSC().getWriteInterface().setBuffer(null); return false; } // reset positions in each of the buffers for (int i = 0; i < stop; i++) { list[i].position(this.positionList[i]); } getTSC().getWriteInterface().setBuffers(list); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Reset positions on (" + stop + ") write buffers"); } return true; }
[ "private", "boolean", "resetWriteBuffers", "(", ")", "{", "int", "stop", "=", "getPendingStop", "(", ")", ";", "WsByteBuffer", "[", "]", "list", "=", "getPendingBuffers", "(", ")", ";", "// verify we can actually attempt the re-write", "if", "(", "null", "==", "this", ".", "positionList", "||", "null", "==", "list", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "{", "Tr", ".", "debug", "(", "tc", ",", "\"Error in resetBuffers: posList: \"", "+", "this", ".", "positionList", "+", "\" list: \"", "+", "list", ")", ";", "}", "getTSC", "(", ")", ".", "getWriteInterface", "(", ")", ".", "setBuffer", "(", "null", ")", ";", "return", "false", ";", "}", "// reset positions in each of the buffers", "for", "(", "int", "i", "=", "0", ";", "i", "<", "stop", ";", "i", "++", ")", "{", "list", "[", "i", "]", ".", "position", "(", "this", ".", "positionList", "[", "i", "]", ")", ";", "}", "getTSC", "(", ")", ".", "getWriteInterface", "(", ")", ".", "setBuffers", "(", "list", ")", ";", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "{", "Tr", ".", "debug", "(", "tc", ",", "\"Reset positions on (\"", "+", "stop", "+", "\") write buffers\"", ")", ";", "}", "return", "true", ";", "}" ]
Reset the position on all of the existing write buffers back so we can resend them all, as we don't know what actually made it out before the error occurred. @return boolean (true means success on resetting them all)
[ "Reset", "the", "position", "on", "all", "of", "the", "existing", "write", "buffers", "back", "so", "we", "can", "resend", "them", "all", "as", "we", "don", "t", "know", "what", "actually", "made", "it", "out", "before", "the", "error", "occurred", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/internal/outbound/HttpOutboundServiceContextImpl.java#L326-L348
train
OpenLiberty/open-liberty
dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/internal/outbound/HttpOutboundServiceContextImpl.java
HttpOutboundServiceContextImpl.nowReconnectedAsync
protected void nowReconnectedAsync() { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Reconnected async for " + this); } // reset the data buffers first if (!resetWriteBuffers()) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Resetting buffers (async) failed"); } // otherwise pass the error along to the channel above us, or close // the connection if nobody is above IOException ioe = new IOException("Failed reconnect"); if (null != getAppWriteCallback()) { getAppWriteCallback().error(getVC(), ioe); } else { // nobody above us, just close the connection getLink().getDeviceLink().close(getVC(), ioe); } return; } // now that we've reconnected, we should reset the "broken" flag. First // we set it to the default and then recheck the request msg setPersistent(true); updatePersistence(getRequestImpl()); // in case we previously read any partial data, clean out the response resetRead(); // attempt to write the data VirtualConnection rc = getTSC().getWriteInterface().write(TCPWriteRequestContext.WRITE_ALL_DATA, HttpOSCWriteCallback.getRef(), isForceAsync(), getWriteTimeout()); if (null != rc) { // if we've finished writing part of a request, let the channel // above know that it can write more, otherwise start the read // for the response if (!isMessageSent()) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Calling callback.complete of app channel."); } getAppWriteCallback().complete(getLink().getVirtualConnection()); } else { if (isReadAheadEnabled()) { // after a reconnect, there is no more read-ahead active this.bReadAheadEnabled = false; } // force an async read for the response now. Avoid trying to // re-use any existing read buffer to skip complexity with // adjusting for partial reads before the reconnect. setupJITRead(getHttpConfig().getIncomingHdrBufferSize()); getTSC().getReadInterface().read(1, HttpOSCReadCallback.getRef(), true, getReadTimeout()); } } }
java
protected void nowReconnectedAsync() { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Reconnected async for " + this); } // reset the data buffers first if (!resetWriteBuffers()) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Resetting buffers (async) failed"); } // otherwise pass the error along to the channel above us, or close // the connection if nobody is above IOException ioe = new IOException("Failed reconnect"); if (null != getAppWriteCallback()) { getAppWriteCallback().error(getVC(), ioe); } else { // nobody above us, just close the connection getLink().getDeviceLink().close(getVC(), ioe); } return; } // now that we've reconnected, we should reset the "broken" flag. First // we set it to the default and then recheck the request msg setPersistent(true); updatePersistence(getRequestImpl()); // in case we previously read any partial data, clean out the response resetRead(); // attempt to write the data VirtualConnection rc = getTSC().getWriteInterface().write(TCPWriteRequestContext.WRITE_ALL_DATA, HttpOSCWriteCallback.getRef(), isForceAsync(), getWriteTimeout()); if (null != rc) { // if we've finished writing part of a request, let the channel // above know that it can write more, otherwise start the read // for the response if (!isMessageSent()) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Calling callback.complete of app channel."); } getAppWriteCallback().complete(getLink().getVirtualConnection()); } else { if (isReadAheadEnabled()) { // after a reconnect, there is no more read-ahead active this.bReadAheadEnabled = false; } // force an async read for the response now. Avoid trying to // re-use any existing read buffer to skip complexity with // adjusting for partial reads before the reconnect. setupJITRead(getHttpConfig().getIncomingHdrBufferSize()); getTSC().getReadInterface().read(1, HttpOSCReadCallback.getRef(), true, getReadTimeout()); } } }
[ "protected", "void", "nowReconnectedAsync", "(", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "{", "Tr", ".", "debug", "(", "tc", ",", "\"Reconnected async for \"", "+", "this", ")", ";", "}", "// reset the data buffers first", "if", "(", "!", "resetWriteBuffers", "(", ")", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "{", "Tr", ".", "debug", "(", "tc", ",", "\"Resetting buffers (async) failed\"", ")", ";", "}", "// otherwise pass the error along to the channel above us, or close", "// the connection if nobody is above", "IOException", "ioe", "=", "new", "IOException", "(", "\"Failed reconnect\"", ")", ";", "if", "(", "null", "!=", "getAppWriteCallback", "(", ")", ")", "{", "getAppWriteCallback", "(", ")", ".", "error", "(", "getVC", "(", ")", ",", "ioe", ")", ";", "}", "else", "{", "// nobody above us, just close the connection", "getLink", "(", ")", ".", "getDeviceLink", "(", ")", ".", "close", "(", "getVC", "(", ")", ",", "ioe", ")", ";", "}", "return", ";", "}", "// now that we've reconnected, we should reset the \"broken\" flag. First", "// we set it to the default and then recheck the request msg", "setPersistent", "(", "true", ")", ";", "updatePersistence", "(", "getRequestImpl", "(", ")", ")", ";", "// in case we previously read any partial data, clean out the response", "resetRead", "(", ")", ";", "// attempt to write the data", "VirtualConnection", "rc", "=", "getTSC", "(", ")", ".", "getWriteInterface", "(", ")", ".", "write", "(", "TCPWriteRequestContext", ".", "WRITE_ALL_DATA", ",", "HttpOSCWriteCallback", ".", "getRef", "(", ")", ",", "isForceAsync", "(", ")", ",", "getWriteTimeout", "(", ")", ")", ";", "if", "(", "null", "!=", "rc", ")", "{", "// if we've finished writing part of a request, let the channel", "// above know that it can write more, otherwise start the read", "// for the response", "if", "(", "!", "isMessageSent", "(", ")", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "{", "Tr", ".", "debug", "(", "tc", ",", "\"Calling callback.complete of app channel.\"", ")", ";", "}", "getAppWriteCallback", "(", ")", ".", "complete", "(", "getLink", "(", ")", ".", "getVirtualConnection", "(", ")", ")", ";", "}", "else", "{", "if", "(", "isReadAheadEnabled", "(", ")", ")", "{", "// after a reconnect, there is no more read-ahead active", "this", ".", "bReadAheadEnabled", "=", "false", ";", "}", "// force an async read for the response now. Avoid trying to", "// re-use any existing read buffer to skip complexity with", "// adjusting for partial reads before the reconnect.", "setupJITRead", "(", "getHttpConfig", "(", ")", ".", "getIncomingHdrBufferSize", "(", ")", ")", ";", "getTSC", "(", ")", ".", "getReadInterface", "(", ")", ".", "read", "(", "1", ",", "HttpOSCReadCallback", ".", "getRef", "(", ")", ",", "true", ",", "getReadTimeout", "(", ")", ")", ";", "}", "}", "}" ]
Once we know we are reconnected to the target server, reset the TCP buffers and start the async resend.
[ "Once", "we", "know", "we", "are", "reconnected", "to", "the", "target", "server", "reset", "the", "TCP", "buffers", "and", "start", "the", "async", "resend", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/internal/outbound/HttpOutboundServiceContextImpl.java#L354-L407
train
OpenLiberty/open-liberty
dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/internal/outbound/HttpOutboundServiceContextImpl.java
HttpOutboundServiceContextImpl.nowReconnectedSync
protected void nowReconnectedSync(IOException originalExcep) throws IOException { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Reconnected sync for " + this); } if (!resetWriteBuffers()) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Resetting buffers (sync) failed"); } throw originalExcep; } // now that we've reconnected, we should reset the "broken" flag. First // we set it to the default and then recheck the request msg setPersistent(true); updatePersistence(getRequestImpl()); // Note: during a sync path, we don't actually enable reconnects once // we start reading and parsing the response (only async path) // in case we read any partial data, we need to clean out the response // resetRead(); if (isReadAheadEnabled()) { // after a reconnect, there is no more read-ahead active this.bReadAheadEnabled = false; } try { getTSC().getWriteInterface().write(TCPWriteRequestContext.WRITE_ALL_DATA, getWriteTimeout()); } catch (IOException ioe) { // no FFDC required // just set the "broken" connection flag setPersistent(false); throw ioe; } }
java
protected void nowReconnectedSync(IOException originalExcep) throws IOException { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Reconnected sync for " + this); } if (!resetWriteBuffers()) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Resetting buffers (sync) failed"); } throw originalExcep; } // now that we've reconnected, we should reset the "broken" flag. First // we set it to the default and then recheck the request msg setPersistent(true); updatePersistence(getRequestImpl()); // Note: during a sync path, we don't actually enable reconnects once // we start reading and parsing the response (only async path) // in case we read any partial data, we need to clean out the response // resetRead(); if (isReadAheadEnabled()) { // after a reconnect, there is no more read-ahead active this.bReadAheadEnabled = false; } try { getTSC().getWriteInterface().write(TCPWriteRequestContext.WRITE_ALL_DATA, getWriteTimeout()); } catch (IOException ioe) { // no FFDC required // just set the "broken" connection flag setPersistent(false); throw ioe; } }
[ "protected", "void", "nowReconnectedSync", "(", "IOException", "originalExcep", ")", "throws", "IOException", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "{", "Tr", ".", "debug", "(", "tc", ",", "\"Reconnected sync for \"", "+", "this", ")", ";", "}", "if", "(", "!", "resetWriteBuffers", "(", ")", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "{", "Tr", ".", "debug", "(", "tc", ",", "\"Resetting buffers (sync) failed\"", ")", ";", "}", "throw", "originalExcep", ";", "}", "// now that we've reconnected, we should reset the \"broken\" flag. First", "// we set it to the default and then recheck the request msg", "setPersistent", "(", "true", ")", ";", "updatePersistence", "(", "getRequestImpl", "(", ")", ")", ";", "// Note: during a sync path, we don't actually enable reconnects once", "// we start reading and parsing the response (only async path)", "// in case we read any partial data, we need to clean out the response", "// resetRead();", "if", "(", "isReadAheadEnabled", "(", ")", ")", "{", "// after a reconnect, there is no more read-ahead active", "this", ".", "bReadAheadEnabled", "=", "false", ";", "}", "try", "{", "getTSC", "(", ")", ".", "getWriteInterface", "(", ")", ".", "write", "(", "TCPWriteRequestContext", ".", "WRITE_ALL_DATA", ",", "getWriteTimeout", "(", ")", ")", ";", "}", "catch", "(", "IOException", "ioe", ")", "{", "// no FFDC required", "// just set the \"broken\" connection flag", "setPersistent", "(", "false", ")", ";", "throw", "ioe", ";", "}", "}" ]
Once we've reconnected to the target server, attempt to redo the sync write of the buffers. If another error happens, simply pass that back up the stack. @param originalExcep @throws IOException
[ "Once", "we", "ve", "reconnected", "to", "the", "target", "server", "attempt", "to", "redo", "the", "sync", "write", "of", "the", "buffers", ".", "If", "another", "error", "happens", "simply", "pass", "that", "back", "up", "the", "stack", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/internal/outbound/HttpOutboundServiceContextImpl.java#L417-L450
train
OpenLiberty/open-liberty
dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/internal/outbound/HttpOutboundServiceContextImpl.java
HttpOutboundServiceContextImpl.startEarlyRead
private VirtualConnection startEarlyRead(InterChannelCallback cb, boolean forceQueue) { // disallow rewrites once we start mixing the request and temp responses getLink().disallowRewrites(); setAppReadCallback(cb); // check for an existing final response if (headersParsed() && !getResponseImpl().isTemporaryStatusCode()) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "earlyRead: Final response already received."); } if (forceQueue) { cb.complete(getVC()); return null; } return getVC(); } // otherwise, if a message is already parsed, then the assumption is // that the app channel above has already looked at it and is now asking // for the next, so clear out the previous message and start a read if (headersParsed()) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "earlyRead: Message exists, isOwner: " + isResponseOwner()); } resetMsgParsedState(); if (!isResponseOwner()) { // null our reference as not being owner means another SC has this // message already (i.e. the proxy passed it to the inbound // side) and then create the new object setMyResponse(null); getResponseImpl(); } else { // otherwise clear the existing response getResponseImpl().clear(); } } // start the read/parse cycle for the next response message VirtualConnection vc = parseResponseMessageAsync(); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "earlyRead: return vc=" + vc); } if (null != vc && forceQueue) { cb.complete(getVC()); return null; } return vc; }
java
private VirtualConnection startEarlyRead(InterChannelCallback cb, boolean forceQueue) { // disallow rewrites once we start mixing the request and temp responses getLink().disallowRewrites(); setAppReadCallback(cb); // check for an existing final response if (headersParsed() && !getResponseImpl().isTemporaryStatusCode()) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "earlyRead: Final response already received."); } if (forceQueue) { cb.complete(getVC()); return null; } return getVC(); } // otherwise, if a message is already parsed, then the assumption is // that the app channel above has already looked at it and is now asking // for the next, so clear out the previous message and start a read if (headersParsed()) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "earlyRead: Message exists, isOwner: " + isResponseOwner()); } resetMsgParsedState(); if (!isResponseOwner()) { // null our reference as not being owner means another SC has this // message already (i.e. the proxy passed it to the inbound // side) and then create the new object setMyResponse(null); getResponseImpl(); } else { // otherwise clear the existing response getResponseImpl().clear(); } } // start the read/parse cycle for the next response message VirtualConnection vc = parseResponseMessageAsync(); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "earlyRead: return vc=" + vc); } if (null != vc && forceQueue) { cb.complete(getVC()); return null; } return vc; }
[ "private", "VirtualConnection", "startEarlyRead", "(", "InterChannelCallback", "cb", ",", "boolean", "forceQueue", ")", "{", "// disallow rewrites once we start mixing the request and temp responses", "getLink", "(", ")", ".", "disallowRewrites", "(", ")", ";", "setAppReadCallback", "(", "cb", ")", ";", "// check for an existing final response", "if", "(", "headersParsed", "(", ")", "&&", "!", "getResponseImpl", "(", ")", ".", "isTemporaryStatusCode", "(", ")", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "{", "Tr", ".", "debug", "(", "tc", ",", "\"earlyRead: Final response already received.\"", ")", ";", "}", "if", "(", "forceQueue", ")", "{", "cb", ".", "complete", "(", "getVC", "(", ")", ")", ";", "return", "null", ";", "}", "return", "getVC", "(", ")", ";", "}", "// otherwise, if a message is already parsed, then the assumption is", "// that the app channel above has already looked at it and is now asking", "// for the next, so clear out the previous message and start a read", "if", "(", "headersParsed", "(", ")", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "{", "Tr", ".", "debug", "(", "tc", ",", "\"earlyRead: Message exists, isOwner: \"", "+", "isResponseOwner", "(", ")", ")", ";", "}", "resetMsgParsedState", "(", ")", ";", "if", "(", "!", "isResponseOwner", "(", ")", ")", "{", "// null our reference as not being owner means another SC has this", "// message already (i.e. the proxy passed it to the inbound", "// side) and then create the new object", "setMyResponse", "(", "null", ")", ";", "getResponseImpl", "(", ")", ";", "}", "else", "{", "// otherwise clear the existing response", "getResponseImpl", "(", ")", ".", "clear", "(", ")", ";", "}", "}", "// start the read/parse cycle for the next response message", "VirtualConnection", "vc", "=", "parseResponseMessageAsync", "(", ")", ";", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "{", "Tr", ".", "debug", "(", "tc", ",", "\"earlyRead: return vc=\"", "+", "vc", ")", ";", "}", "if", "(", "null", "!=", "vc", "&&", "forceQueue", ")", "{", "cb", ".", "complete", "(", "getVC", "(", ")", ")", ";", "return", "null", ";", "}", "return", "vc", ";", "}" ]
Common utility method to start the response read now, regardless of the request message state. @param cb - app side read callback @param forceQueue @return VirtualConnection - non null if the final response has already arrived
[ "Common", "utility", "method", "to", "start", "the", "response", "read", "now", "regardless", "of", "the", "request", "message", "state", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/internal/outbound/HttpOutboundServiceContextImpl.java#L544-L590
train
OpenLiberty/open-liberty
dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/internal/outbound/HttpOutboundServiceContextImpl.java
HttpOutboundServiceContextImpl.setRequest
@Override public void setRequest(HttpRequestMessage msg) throws IllegalRequestObjectException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.entry(tc, "setRequest: " + msg); } // null message isn't allowed if (null == msg) { throw new IllegalRequestObjectException("Illegal null message"); } HttpRequestMessageImpl temp = null; try { temp = (HttpRequestMessageImpl) msg; } catch (ClassCastException cce) { // no FFDC required if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Non msg impl passed to setRequest"); } throw new IllegalRequestObjectException("Invalid message provided"); } // possibly clean up any existing request object if (null != getMyRequest() && isRequestOwner()) { if (!getMyRequest().equals(temp)) { getMyRequest().destroy(); } else { if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) { Tr.event(tc, "Caller overlaying same message"); } } } // set the new object in place setMyRequest(temp); // 335554 : the message init() will overwrite the version based on config // and needs to be reset back to whatever we started with here. VersionValues version = temp.getVersionValue(); getMyRequest().init(this); getMyRequest().setVersion(version); updatePersistence(getMyRequest()); getResponseImpl().setHeaderChangeLimit(getMyRequest().getHeaderChangeLimit()); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.exit(tc, "setRequest"); } }
java
@Override public void setRequest(HttpRequestMessage msg) throws IllegalRequestObjectException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.entry(tc, "setRequest: " + msg); } // null message isn't allowed if (null == msg) { throw new IllegalRequestObjectException("Illegal null message"); } HttpRequestMessageImpl temp = null; try { temp = (HttpRequestMessageImpl) msg; } catch (ClassCastException cce) { // no FFDC required if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Non msg impl passed to setRequest"); } throw new IllegalRequestObjectException("Invalid message provided"); } // possibly clean up any existing request object if (null != getMyRequest() && isRequestOwner()) { if (!getMyRequest().equals(temp)) { getMyRequest().destroy(); } else { if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) { Tr.event(tc, "Caller overlaying same message"); } } } // set the new object in place setMyRequest(temp); // 335554 : the message init() will overwrite the version based on config // and needs to be reset back to whatever we started with here. VersionValues version = temp.getVersionValue(); getMyRequest().init(this); getMyRequest().setVersion(version); updatePersistence(getMyRequest()); getResponseImpl().setHeaderChangeLimit(getMyRequest().getHeaderChangeLimit()); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.exit(tc, "setRequest"); } }
[ "@", "Override", "public", "void", "setRequest", "(", "HttpRequestMessage", "msg", ")", "throws", "IllegalRequestObjectException", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "{", "Tr", ".", "entry", "(", "tc", ",", "\"setRequest: \"", "+", "msg", ")", ";", "}", "// null message isn't allowed", "if", "(", "null", "==", "msg", ")", "{", "throw", "new", "IllegalRequestObjectException", "(", "\"Illegal null message\"", ")", ";", "}", "HttpRequestMessageImpl", "temp", "=", "null", ";", "try", "{", "temp", "=", "(", "HttpRequestMessageImpl", ")", "msg", ";", "}", "catch", "(", "ClassCastException", "cce", ")", "{", "// no FFDC required", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "{", "Tr", ".", "debug", "(", "tc", ",", "\"Non msg impl passed to setRequest\"", ")", ";", "}", "throw", "new", "IllegalRequestObjectException", "(", "\"Invalid message provided\"", ")", ";", "}", "// possibly clean up any existing request object", "if", "(", "null", "!=", "getMyRequest", "(", ")", "&&", "isRequestOwner", "(", ")", ")", "{", "if", "(", "!", "getMyRequest", "(", ")", ".", "equals", "(", "temp", ")", ")", "{", "getMyRequest", "(", ")", ".", "destroy", "(", ")", ";", "}", "else", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEventEnabled", "(", ")", ")", "{", "Tr", ".", "event", "(", "tc", ",", "\"Caller overlaying same message\"", ")", ";", "}", "}", "}", "// set the new object in place", "setMyRequest", "(", "temp", ")", ";", "// 335554 : the message init() will overwrite the version based on config", "// and needs to be reset back to whatever we started with here.", "VersionValues", "version", "=", "temp", ".", "getVersionValue", "(", ")", ";", "getMyRequest", "(", ")", ".", "init", "(", "this", ")", ";", "getMyRequest", "(", ")", ".", "setVersion", "(", "version", ")", ";", "updatePersistence", "(", "getMyRequest", "(", ")", ")", ";", "getResponseImpl", "(", ")", ".", "setHeaderChangeLimit", "(", "getMyRequest", "(", ")", ".", "getHeaderChangeLimit", "(", ")", ")", ";", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "{", "Tr", ".", "exit", "(", "tc", ",", "\"setRequest\"", ")", ";", "}", "}" ]
Set the request message in this service context. @param msg @throws IllegalRequestObjectException
[ "Set", "the", "request", "message", "in", "this", "service", "context", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/internal/outbound/HttpOutboundServiceContextImpl.java#L824-L868
train
OpenLiberty/open-liberty
dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/internal/outbound/HttpOutboundServiceContextImpl.java
HttpOutboundServiceContextImpl.sendRequestHeaders
@Override public void sendRequestHeaders() throws IOException, MessageSentException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.entry(tc, "sendRequestHeaders(sync)"); } if (headersSent()) { throw new MessageSentException("Headers already sent"); } setPartialBody(true); getLink().setAllowReconnect(true); try { sendHeaders(getRequestImpl()); } catch (IOException e) { // no FFDC required reConnect(e); } // check to see if we need to read the response now if (shouldReadResponseImmediately()) { startResponseReadSync(); } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.exit(tc, "sendRequestHeaders(sync)"); } }
java
@Override public void sendRequestHeaders() throws IOException, MessageSentException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.entry(tc, "sendRequestHeaders(sync)"); } if (headersSent()) { throw new MessageSentException("Headers already sent"); } setPartialBody(true); getLink().setAllowReconnect(true); try { sendHeaders(getRequestImpl()); } catch (IOException e) { // no FFDC required reConnect(e); } // check to see if we need to read the response now if (shouldReadResponseImmediately()) { startResponseReadSync(); } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.exit(tc, "sendRequestHeaders(sync)"); } }
[ "@", "Override", "public", "void", "sendRequestHeaders", "(", ")", "throws", "IOException", ",", "MessageSentException", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "{", "Tr", ".", "entry", "(", "tc", ",", "\"sendRequestHeaders(sync)\"", ")", ";", "}", "if", "(", "headersSent", "(", ")", ")", "{", "throw", "new", "MessageSentException", "(", "\"Headers already sent\"", ")", ";", "}", "setPartialBody", "(", "true", ")", ";", "getLink", "(", ")", ".", "setAllowReconnect", "(", "true", ")", ";", "try", "{", "sendHeaders", "(", "getRequestImpl", "(", ")", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "// no FFDC required", "reConnect", "(", "e", ")", ";", "}", "// check to see if we need to read the response now", "if", "(", "shouldReadResponseImmediately", "(", ")", ")", "{", "startResponseReadSync", "(", ")", ";", "}", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "{", "Tr", ".", "exit", "(", "tc", ",", "\"sendRequestHeaders(sync)\"", ")", ";", "}", "}" ]
Send the headers for the outgoing request synchronously. @throws IOException -- if a socket error occurs @throws MessageSentException -- if the headers have already been sent
[ "Send", "the", "headers", "for", "the", "outgoing", "request", "synchronously", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/internal/outbound/HttpOutboundServiceContextImpl.java#L878-L903
train
OpenLiberty/open-liberty
dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/internal/outbound/HttpOutboundServiceContextImpl.java
HttpOutboundServiceContextImpl.sendRequestHeaders
@Override public VirtualConnection sendRequestHeaders(InterChannelCallback callback, boolean bForce) throws MessageSentException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.entry(tc, "sendRequestHeaders(async)"); } if (headersSent()) { throw new MessageSentException("Headers already sent"); } setPartialBody(true); getLink().setAllowReconnect(true); setForceAsync(bForce); setAppWriteCallback(callback); VirtualConnection vc = sendHeaders(getRequestImpl(), HttpOSCWriteCallback.getRef()); // Note: if forcequeue is true, then we will not get a VC object as // the lower layer will use the callback and return null if (null != vc && shouldReadResponseImmediately()) { // write worked already and we need to read the response headers now vc = startResponseRead(); } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.exit(tc, "sendRequestHeaders(async): " + vc); } return vc; }
java
@Override public VirtualConnection sendRequestHeaders(InterChannelCallback callback, boolean bForce) throws MessageSentException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.entry(tc, "sendRequestHeaders(async)"); } if (headersSent()) { throw new MessageSentException("Headers already sent"); } setPartialBody(true); getLink().setAllowReconnect(true); setForceAsync(bForce); setAppWriteCallback(callback); VirtualConnection vc = sendHeaders(getRequestImpl(), HttpOSCWriteCallback.getRef()); // Note: if forcequeue is true, then we will not get a VC object as // the lower layer will use the callback and return null if (null != vc && shouldReadResponseImmediately()) { // write worked already and we need to read the response headers now vc = startResponseRead(); } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.exit(tc, "sendRequestHeaders(async): " + vc); } return vc; }
[ "@", "Override", "public", "VirtualConnection", "sendRequestHeaders", "(", "InterChannelCallback", "callback", ",", "boolean", "bForce", ")", "throws", "MessageSentException", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "{", "Tr", ".", "entry", "(", "tc", ",", "\"sendRequestHeaders(async)\"", ")", ";", "}", "if", "(", "headersSent", "(", ")", ")", "{", "throw", "new", "MessageSentException", "(", "\"Headers already sent\"", ")", ";", "}", "setPartialBody", "(", "true", ")", ";", "getLink", "(", ")", ".", "setAllowReconnect", "(", "true", ")", ";", "setForceAsync", "(", "bForce", ")", ";", "setAppWriteCallback", "(", "callback", ")", ";", "VirtualConnection", "vc", "=", "sendHeaders", "(", "getRequestImpl", "(", ")", ",", "HttpOSCWriteCallback", ".", "getRef", "(", ")", ")", ";", "// Note: if forcequeue is true, then we will not get a VC object as", "// the lower layer will use the callback and return null", "if", "(", "null", "!=", "vc", "&&", "shouldReadResponseImmediately", "(", ")", ")", "{", "// write worked already and we need to read the response headers now", "vc", "=", "startResponseRead", "(", ")", ";", "}", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "{", "Tr", ".", "exit", "(", "tc", ",", "\"sendRequestHeaders(async): \"", "+", "vc", ")", ";", "}", "return", "vc", ";", "}" ]
Send the headers for the outgoing request asynchronously. If the write can be done immediately, the VirtualConnection will be returned and the callback will not be used. The caller is responsible for handling that situation in their code. A null return code means that the async write is in progress. The boolean bForce parameter allows the caller to force the asynchronous action even if it could be handled immediately. The return code will always be null and the callback always used. @param callback @param bForce @return VirtualConnection @throws MessageSentException -- if the headers have already been sent
[ "Send", "the", "headers", "for", "the", "outgoing", "request", "asynchronously", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/internal/outbound/HttpOutboundServiceContextImpl.java#L923-L947
train
OpenLiberty/open-liberty
dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/internal/outbound/HttpOutboundServiceContextImpl.java
HttpOutboundServiceContextImpl.sendRequestBody
@Override public void sendRequestBody(WsByteBuffer[] body) throws IOException, MessageSentException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.entry(tc, "sendRequestBody(sync)"); } if (isMessageSent()) { throw new MessageSentException("Message already sent"); } // if headers haven't been sent, set for partial body transfer if (!headersSent()) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Setting partial body true"); } setPartialBody(true); } getLink().setAllowReconnect(true); try { sendOutgoing(body, getRequestImpl()); } catch (IOException e) { // no FFDC necessary reConnect(e); } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.exit(tc, "sendRequestBody(sync)"); } }
java
@Override public void sendRequestBody(WsByteBuffer[] body) throws IOException, MessageSentException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.entry(tc, "sendRequestBody(sync)"); } if (isMessageSent()) { throw new MessageSentException("Message already sent"); } // if headers haven't been sent, set for partial body transfer if (!headersSent()) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Setting partial body true"); } setPartialBody(true); } getLink().setAllowReconnect(true); try { sendOutgoing(body, getRequestImpl()); } catch (IOException e) { // no FFDC necessary reConnect(e); } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.exit(tc, "sendRequestBody(sync)"); } }
[ "@", "Override", "public", "void", "sendRequestBody", "(", "WsByteBuffer", "[", "]", "body", ")", "throws", "IOException", ",", "MessageSentException", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "{", "Tr", ".", "entry", "(", "tc", ",", "\"sendRequestBody(sync)\"", ")", ";", "}", "if", "(", "isMessageSent", "(", ")", ")", "{", "throw", "new", "MessageSentException", "(", "\"Message already sent\"", ")", ";", "}", "// if headers haven't been sent, set for partial body transfer", "if", "(", "!", "headersSent", "(", ")", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "{", "Tr", ".", "debug", "(", "tc", ",", "\"Setting partial body true\"", ")", ";", "}", "setPartialBody", "(", "true", ")", ";", "}", "getLink", "(", ")", ".", "setAllowReconnect", "(", "true", ")", ";", "try", "{", "sendOutgoing", "(", "body", ",", "getRequestImpl", "(", ")", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "// no FFDC necessary", "reConnect", "(", "e", ")", ";", "}", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "{", "Tr", ".", "exit", "(", "tc", ",", "\"sendRequestBody(sync)\"", ")", ";", "}", "}" ]
Send the given body buffers for the outgoing request synchronously. If chunked encoding is set, then each call to this method will be considered a "chunk" and encoded as such. If the message is Content-Length defined, then the buffers will simply be sent out with no modifications. Note: if headers have not already been sent, then the first call to this method will send the headers. @param body @throws IOException -- if a socket error occurs @throws MessageSentException -- if a finishMessage API was already used
[ "Send", "the", "given", "body", "buffers", "for", "the", "outgoing", "request", "synchronously", ".", "If", "chunked", "encoding", "is", "set", "then", "each", "call", "to", "this", "method", "will", "be", "considered", "a", "chunk", "and", "encoded", "as", "such", ".", "If", "the", "message", "is", "Content", "-", "Length", "defined", "then", "the", "buffers", "will", "simply", "be", "sent", "out", "with", "no", "modifications", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/internal/outbound/HttpOutboundServiceContextImpl.java#L965-L994
train
OpenLiberty/open-liberty
dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/internal/outbound/HttpOutboundServiceContextImpl.java
HttpOutboundServiceContextImpl.sendRequestBody
@Override public VirtualConnection sendRequestBody(WsByteBuffer[] body, InterChannelCallback callback, boolean bForce) throws MessageSentException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.entry(tc, "sendRequestBody(async)"); } if (isMessageSent()) { throw new MessageSentException("Message already sent"); } // if headers haven't been sent, then set for partial body transfer if (!headersSent()) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Setting partial body true"); } setPartialBody(true); } getLink().setAllowReconnect(true); setForceAsync(bForce); setAppWriteCallback(callback); VirtualConnection vc = sendOutgoing(body, getRequestImpl(), HttpOSCWriteCallback.getRef()); // Note: if forcequeue is true, then we will not get a VC object as // the lower layer will use the callback and return null if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.exit(tc, "sendRequestBody(async): " + vc); } return vc; }
java
@Override public VirtualConnection sendRequestBody(WsByteBuffer[] body, InterChannelCallback callback, boolean bForce) throws MessageSentException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.entry(tc, "sendRequestBody(async)"); } if (isMessageSent()) { throw new MessageSentException("Message already sent"); } // if headers haven't been sent, then set for partial body transfer if (!headersSent()) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Setting partial body true"); } setPartialBody(true); } getLink().setAllowReconnect(true); setForceAsync(bForce); setAppWriteCallback(callback); VirtualConnection vc = sendOutgoing(body, getRequestImpl(), HttpOSCWriteCallback.getRef()); // Note: if forcequeue is true, then we will not get a VC object as // the lower layer will use the callback and return null if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.exit(tc, "sendRequestBody(async): " + vc); } return vc; }
[ "@", "Override", "public", "VirtualConnection", "sendRequestBody", "(", "WsByteBuffer", "[", "]", "body", ",", "InterChannelCallback", "callback", ",", "boolean", "bForce", ")", "throws", "MessageSentException", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "{", "Tr", ".", "entry", "(", "tc", ",", "\"sendRequestBody(async)\"", ")", ";", "}", "if", "(", "isMessageSent", "(", ")", ")", "{", "throw", "new", "MessageSentException", "(", "\"Message already sent\"", ")", ";", "}", "// if headers haven't been sent, then set for partial body transfer", "if", "(", "!", "headersSent", "(", ")", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "{", "Tr", ".", "debug", "(", "tc", ",", "\"Setting partial body true\"", ")", ";", "}", "setPartialBody", "(", "true", ")", ";", "}", "getLink", "(", ")", ".", "setAllowReconnect", "(", "true", ")", ";", "setForceAsync", "(", "bForce", ")", ";", "setAppWriteCallback", "(", "callback", ")", ";", "VirtualConnection", "vc", "=", "sendOutgoing", "(", "body", ",", "getRequestImpl", "(", ")", ",", "HttpOSCWriteCallback", ".", "getRef", "(", ")", ")", ";", "// Note: if forcequeue is true, then we will not get a VC object as", "// the lower layer will use the callback and return null", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "{", "Tr", ".", "exit", "(", "tc", ",", "\"sendRequestBody(async): \"", "+", "vc", ")", ";", "}", "return", "vc", ";", "}" ]
Send the given body buffers for the outgoing request asynchronously. If chunked encoding is set, then each call to this method will be considered a "chunk" and encoded as such. If the message is Content-Length defined, then the buffers will simply be sent out with no modifications. Note: if headers have not already been sent, then the first call to this method will send the headers. If the write can be done immediately, the VirtualConnection will be returned and the callback will not be used. The caller is responsible for handling that situation in their code. A null return code means that the async write is in progress. The boolean bForce parameter allows the caller to force the asynchronous action even if it could be handled immediately. The return code will always be null and the callback always used. @param body @param callback @param bForce @return VirtualConnection @throws MessageSentException -- if a finishMessage API was already used
[ "Send", "the", "given", "body", "buffers", "for", "the", "outgoing", "request", "asynchronously", ".", "If", "chunked", "encoding", "is", "set", "then", "each", "call", "to", "this", "method", "will", "be", "considered", "a", "chunk", "and", "encoded", "as", "such", ".", "If", "the", "message", "is", "Content", "-", "Length", "defined", "then", "the", "buffers", "will", "simply", "be", "sent", "out", "with", "no", "modifications", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/internal/outbound/HttpOutboundServiceContextImpl.java#L1022-L1051
train
OpenLiberty/open-liberty
dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/internal/outbound/HttpOutboundServiceContextImpl.java
HttpOutboundServiceContextImpl.finishRequestMessage
@Override public void finishRequestMessage(WsByteBuffer[] body) throws IOException, MessageSentException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.entry(tc, "finishRequestMessage(sync)"); } if (isMessageSent()) { throw new MessageSentException("Message already sent"); } // if headers haven't been sent and chunked encoding is not explicitly // configured, then set this up for Content-Length if (!headersSent()) { if (!getRequestImpl().isChunkedEncodingSet()) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Setting partial body false"); } setPartialBody(false); } } if (getHttpConfig().runningOnZOS()) { // @LIDB3187-27.1 // add this to notify the xmem channel of our final request write getVC().getStateMap().put(HttpConstants.FINAL_WRITE_MARK, "true"); } getLink().setAllowReconnect(true); try { sendFullOutgoing(body, getRequestImpl()); } catch (IOException e) { // no FFDC required reConnect(e); } // LI4335 - if early reads are going, then do not bother with response // message information here if (this.bEarlyReads) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.exit(tc, "finishRequestMessage(sync): early read is active"); } return; } // if the headers are already parsed, then check to see if we should // immediately notify the app channel or start a read for the next // response. if (headersParsed()) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Response headers already parsed"); } if (this.bTempResponsesUsed || !getResponseImpl().isTemporaryStatusCode()) { // app channel wants to see all the responses if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.exit(tc, "finishRequestMessage(sync): already parsed"); } return; } // the app channel does not want to see the previously parsed msg resetRead(); readSyncResponse(); } else { // read for the first response startResponseReadSync(); } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.exit(tc, "finishRequestMessage(sync)"); } }
java
@Override public void finishRequestMessage(WsByteBuffer[] body) throws IOException, MessageSentException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.entry(tc, "finishRequestMessage(sync)"); } if (isMessageSent()) { throw new MessageSentException("Message already sent"); } // if headers haven't been sent and chunked encoding is not explicitly // configured, then set this up for Content-Length if (!headersSent()) { if (!getRequestImpl().isChunkedEncodingSet()) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Setting partial body false"); } setPartialBody(false); } } if (getHttpConfig().runningOnZOS()) { // @LIDB3187-27.1 // add this to notify the xmem channel of our final request write getVC().getStateMap().put(HttpConstants.FINAL_WRITE_MARK, "true"); } getLink().setAllowReconnect(true); try { sendFullOutgoing(body, getRequestImpl()); } catch (IOException e) { // no FFDC required reConnect(e); } // LI4335 - if early reads are going, then do not bother with response // message information here if (this.bEarlyReads) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.exit(tc, "finishRequestMessage(sync): early read is active"); } return; } // if the headers are already parsed, then check to see if we should // immediately notify the app channel or start a read for the next // response. if (headersParsed()) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Response headers already parsed"); } if (this.bTempResponsesUsed || !getResponseImpl().isTemporaryStatusCode()) { // app channel wants to see all the responses if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.exit(tc, "finishRequestMessage(sync): already parsed"); } return; } // the app channel does not want to see the previously parsed msg resetRead(); readSyncResponse(); } else { // read for the first response startResponseReadSync(); } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.exit(tc, "finishRequestMessage(sync)"); } }
[ "@", "Override", "public", "void", "finishRequestMessage", "(", "WsByteBuffer", "[", "]", "body", ")", "throws", "IOException", ",", "MessageSentException", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "{", "Tr", ".", "entry", "(", "tc", ",", "\"finishRequestMessage(sync)\"", ")", ";", "}", "if", "(", "isMessageSent", "(", ")", ")", "{", "throw", "new", "MessageSentException", "(", "\"Message already sent\"", ")", ";", "}", "// if headers haven't been sent and chunked encoding is not explicitly", "// configured, then set this up for Content-Length", "if", "(", "!", "headersSent", "(", ")", ")", "{", "if", "(", "!", "getRequestImpl", "(", ")", ".", "isChunkedEncodingSet", "(", ")", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "{", "Tr", ".", "debug", "(", "tc", ",", "\"Setting partial body false\"", ")", ";", "}", "setPartialBody", "(", "false", ")", ";", "}", "}", "if", "(", "getHttpConfig", "(", ")", ".", "runningOnZOS", "(", ")", ")", "{", "// @LIDB3187-27.1", "// add this to notify the xmem channel of our final request write", "getVC", "(", ")", ".", "getStateMap", "(", ")", ".", "put", "(", "HttpConstants", ".", "FINAL_WRITE_MARK", ",", "\"true\"", ")", ";", "}", "getLink", "(", ")", ".", "setAllowReconnect", "(", "true", ")", ";", "try", "{", "sendFullOutgoing", "(", "body", ",", "getRequestImpl", "(", ")", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "// no FFDC required", "reConnect", "(", "e", ")", ";", "}", "// LI4335 - if early reads are going, then do not bother with response", "// message information here", "if", "(", "this", ".", "bEarlyReads", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "{", "Tr", ".", "exit", "(", "tc", ",", "\"finishRequestMessage(sync): early read is active\"", ")", ";", "}", "return", ";", "}", "// if the headers are already parsed, then check to see if we should", "// immediately notify the app channel or start a read for the next", "// response.", "if", "(", "headersParsed", "(", ")", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "{", "Tr", ".", "debug", "(", "tc", ",", "\"Response headers already parsed\"", ")", ";", "}", "if", "(", "this", ".", "bTempResponsesUsed", "||", "!", "getResponseImpl", "(", ")", ".", "isTemporaryStatusCode", "(", ")", ")", "{", "// app channel wants to see all the responses", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "{", "Tr", ".", "exit", "(", "tc", ",", "\"finishRequestMessage(sync): already parsed\"", ")", ";", "}", "return", ";", "}", "// the app channel does not want to see the previously parsed msg", "resetRead", "(", ")", ";", "readSyncResponse", "(", ")", ";", "}", "else", "{", "// read for the first response", "startResponseReadSync", "(", ")", ";", "}", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "{", "Tr", ".", "exit", "(", "tc", ",", "\"finishRequestMessage(sync)\"", ")", ";", "}", "}" ]
Send the given body buffers for the outgoing request synchronously. If chunked encoding is set, then these buffers will be considered a "chunk" and encoded as such. If the message is Content-Length defined, then the buffers will simply be sent out with no modifications. This marks the end of the outgoing message. This method will return when the response has been received and parsed. Note: if headers have not already been sent, then the first call to this method will send the headers. If this was a chunked encoded message, then the zero-length chunk is automatically appended. @param body (last set of buffers to send, null if no body data) @throws IOException -- if a socket error occurs @throws MessageSentException -- if a finishMessage API was already used
[ "Send", "the", "given", "body", "buffers", "for", "the", "outgoing", "request", "synchronously", ".", "If", "chunked", "encoding", "is", "set", "then", "these", "buffers", "will", "be", "considered", "a", "chunk", "and", "encoded", "as", "such", ".", "If", "the", "message", "is", "Content", "-", "Length", "defined", "then", "the", "buffers", "will", "simply", "be", "sent", "out", "with", "no", "modifications", ".", "This", "marks", "the", "end", "of", "the", "outgoing", "message", ".", "This", "method", "will", "return", "when", "the", "response", "has", "been", "received", "and", "parsed", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/internal/outbound/HttpOutboundServiceContextImpl.java#L1123-L1191
train
OpenLiberty/open-liberty
dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/internal/outbound/HttpOutboundServiceContextImpl.java
HttpOutboundServiceContextImpl.finishRequestMessage
@Override public VirtualConnection finishRequestMessage(WsByteBuffer[] body, InterChannelCallback callback, boolean bForce) throws MessageSentException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.entry(tc, "finishRequestMessage(async)"); } if (isMessageSent()) { throw new MessageSentException("Message already sent"); } // if headers haven't been sent and chunked encoding is not explicitly // configured, then set this up for Content-Length if (!headersSent()) { if (!getRequestImpl().isChunkedEncodingSet()) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Setting partial body false"); } setPartialBody(false); } } if (getHttpConfig().runningOnZOS()) { // @LIDB3187-27.1 // add this to notify the xmem channel of our final request write getVC().getStateMap().put(HttpConstants.FINAL_WRITE_MARK, "true"); } setForceAsync(bForce); getLink().setAllowReconnect(true); setAppWriteCallback(callback); VirtualConnection vc = sendFullOutgoing(body, getRequestImpl(), HttpOSCWriteCallback.getRef()); if (null != vc) { // Note: if forcequeue is true, then we will not get a VC object as // the lower layer will use the callback and return null if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Request write completed immediately."); } // LI4335 - if early reads are going, then do not bother with response // message information here if (this.bEarlyReads) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.exit(tc, "finishRequestMessage(async): early read is active"); } return getVC(); } // if headers are parsed and this is a final response, exit out. // if a temp response and using temps, return out. If temp and not // using temps, keep reading for final if (headersParsed()) { if (this.bTempResponsesUsed || !getResponseImpl().isTemporaryStatusCode()) { // app channel wants to see all the responses if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.exit(tc, "finishRequestMessage(async): already parsed"); } return getVC(); } // the app channel does not want to see the previously parsed msg resetRead(); readAsyncResponse(); vc = null; } else { // start the read for the first response vc = startResponseRead(); } } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.exit(tc, "finishRequestMessage(async): " + vc); } return vc; }
java
@Override public VirtualConnection finishRequestMessage(WsByteBuffer[] body, InterChannelCallback callback, boolean bForce) throws MessageSentException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.entry(tc, "finishRequestMessage(async)"); } if (isMessageSent()) { throw new MessageSentException("Message already sent"); } // if headers haven't been sent and chunked encoding is not explicitly // configured, then set this up for Content-Length if (!headersSent()) { if (!getRequestImpl().isChunkedEncodingSet()) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Setting partial body false"); } setPartialBody(false); } } if (getHttpConfig().runningOnZOS()) { // @LIDB3187-27.1 // add this to notify the xmem channel of our final request write getVC().getStateMap().put(HttpConstants.FINAL_WRITE_MARK, "true"); } setForceAsync(bForce); getLink().setAllowReconnect(true); setAppWriteCallback(callback); VirtualConnection vc = sendFullOutgoing(body, getRequestImpl(), HttpOSCWriteCallback.getRef()); if (null != vc) { // Note: if forcequeue is true, then we will not get a VC object as // the lower layer will use the callback and return null if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Request write completed immediately."); } // LI4335 - if early reads are going, then do not bother with response // message information here if (this.bEarlyReads) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.exit(tc, "finishRequestMessage(async): early read is active"); } return getVC(); } // if headers are parsed and this is a final response, exit out. // if a temp response and using temps, return out. If temp and not // using temps, keep reading for final if (headersParsed()) { if (this.bTempResponsesUsed || !getResponseImpl().isTemporaryStatusCode()) { // app channel wants to see all the responses if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.exit(tc, "finishRequestMessage(async): already parsed"); } return getVC(); } // the app channel does not want to see the previously parsed msg resetRead(); readAsyncResponse(); vc = null; } else { // start the read for the first response vc = startResponseRead(); } } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.exit(tc, "finishRequestMessage(async): " + vc); } return vc; }
[ "@", "Override", "public", "VirtualConnection", "finishRequestMessage", "(", "WsByteBuffer", "[", "]", "body", ",", "InterChannelCallback", "callback", ",", "boolean", "bForce", ")", "throws", "MessageSentException", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "{", "Tr", ".", "entry", "(", "tc", ",", "\"finishRequestMessage(async)\"", ")", ";", "}", "if", "(", "isMessageSent", "(", ")", ")", "{", "throw", "new", "MessageSentException", "(", "\"Message already sent\"", ")", ";", "}", "// if headers haven't been sent and chunked encoding is not explicitly", "// configured, then set this up for Content-Length", "if", "(", "!", "headersSent", "(", ")", ")", "{", "if", "(", "!", "getRequestImpl", "(", ")", ".", "isChunkedEncodingSet", "(", ")", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "{", "Tr", ".", "debug", "(", "tc", ",", "\"Setting partial body false\"", ")", ";", "}", "setPartialBody", "(", "false", ")", ";", "}", "}", "if", "(", "getHttpConfig", "(", ")", ".", "runningOnZOS", "(", ")", ")", "{", "// @LIDB3187-27.1", "// add this to notify the xmem channel of our final request write", "getVC", "(", ")", ".", "getStateMap", "(", ")", ".", "put", "(", "HttpConstants", ".", "FINAL_WRITE_MARK", ",", "\"true\"", ")", ";", "}", "setForceAsync", "(", "bForce", ")", ";", "getLink", "(", ")", ".", "setAllowReconnect", "(", "true", ")", ";", "setAppWriteCallback", "(", "callback", ")", ";", "VirtualConnection", "vc", "=", "sendFullOutgoing", "(", "body", ",", "getRequestImpl", "(", ")", ",", "HttpOSCWriteCallback", ".", "getRef", "(", ")", ")", ";", "if", "(", "null", "!=", "vc", ")", "{", "// Note: if forcequeue is true, then we will not get a VC object as", "// the lower layer will use the callback and return null", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "{", "Tr", ".", "debug", "(", "tc", ",", "\"Request write completed immediately.\"", ")", ";", "}", "// LI4335 - if early reads are going, then do not bother with response", "// message information here", "if", "(", "this", ".", "bEarlyReads", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "{", "Tr", ".", "exit", "(", "tc", ",", "\"finishRequestMessage(async): early read is active\"", ")", ";", "}", "return", "getVC", "(", ")", ";", "}", "// if headers are parsed and this is a final response, exit out.", "// if a temp response and using temps, return out. If temp and not", "// using temps, keep reading for final", "if", "(", "headersParsed", "(", ")", ")", "{", "if", "(", "this", ".", "bTempResponsesUsed", "||", "!", "getResponseImpl", "(", ")", ".", "isTemporaryStatusCode", "(", ")", ")", "{", "// app channel wants to see all the responses", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "{", "Tr", ".", "exit", "(", "tc", ",", "\"finishRequestMessage(async): already parsed\"", ")", ";", "}", "return", "getVC", "(", ")", ";", "}", "// the app channel does not want to see the previously parsed msg", "resetRead", "(", ")", ";", "readAsyncResponse", "(", ")", ";", "vc", "=", "null", ";", "}", "else", "{", "// start the read for the first response", "vc", "=", "startResponseRead", "(", ")", ";", "}", "}", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "{", "Tr", ".", "exit", "(", "tc", ",", "\"finishRequestMessage(async): \"", "+", "vc", ")", ";", "}", "return", "vc", ";", "}" ]
Send the given body buffers for the outgoing request asynchronously. If chunked encoding is set, then these buffers will be considered a "chunk" and encoded as such. If the message is Content-Length defined, then the buffers will simply be sent out with no modifications. This marks the end of the outgoing message. The callback will be called when the response has been received and parsed. Note: if headers have not already been sent, then the first call to this method will send the headers. If this was a chunked encoded message, then the zero-length chunk is automatically appended. If the write can be done immediately, the VirtualConnection will be returned and the callback will not be used. The caller is responsible for handling that situation in their code. A null return code means that the async write is in progress. The boolean bForce parameter allows the caller to force the asynchronous action even if it could be handled immediately. The return code will always be null and the callback always used. @param body (last set of body data, null if no body information) @param callback @param bForce @return VirtualConnection @throws MessageSentException -- if a finishMessage API was already used
[ "Send", "the", "given", "body", "buffers", "for", "the", "outgoing", "request", "asynchronously", ".", "If", "chunked", "encoding", "is", "set", "then", "these", "buffers", "will", "be", "considered", "a", "chunk", "and", "encoded", "as", "such", ".", "If", "the", "message", "is", "Content", "-", "Length", "defined", "then", "the", "buffers", "will", "simply", "be", "sent", "out", "with", "no", "modifications", ".", "This", "marks", "the", "end", "of", "the", "outgoing", "message", ".", "The", "callback", "will", "be", "called", "when", "the", "response", "has", "been", "received", "and", "parsed", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/internal/outbound/HttpOutboundServiceContextImpl.java#L1222-L1291
train
OpenLiberty/open-liberty
dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/internal/outbound/HttpOutboundServiceContextImpl.java
HttpOutboundServiceContextImpl.checkRequestValidity
private HttpInvalidMessageException checkRequestValidity() { if (shouldReadResponseImmediately()) { // ignore body validation as this might happen after sending only // the headers if 100-continue, Upgrade, immediate-read, etc. return null; } long len = getRequest().getContentLength(); long num = getNumBytesWritten(); if (HeaderStorage.NOTSET != len && num != len) { // content-length does not match the number of bytes sent, have to // close the connection since the other end won't be able to read // the body properly if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Request had content-length of " + len + " but sent " + num); } setPersistent(false); return new HttpInvalidMessageException("Request length " + len + " but sent " + num); } return null; }
java
private HttpInvalidMessageException checkRequestValidity() { if (shouldReadResponseImmediately()) { // ignore body validation as this might happen after sending only // the headers if 100-continue, Upgrade, immediate-read, etc. return null; } long len = getRequest().getContentLength(); long num = getNumBytesWritten(); if (HeaderStorage.NOTSET != len && num != len) { // content-length does not match the number of bytes sent, have to // close the connection since the other end won't be able to read // the body properly if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Request had content-length of " + len + " but sent " + num); } setPersistent(false); return new HttpInvalidMessageException("Request length " + len + " but sent " + num); } return null; }
[ "private", "HttpInvalidMessageException", "checkRequestValidity", "(", ")", "{", "if", "(", "shouldReadResponseImmediately", "(", ")", ")", "{", "// ignore body validation as this might happen after sending only", "// the headers if 100-continue, Upgrade, immediate-read, etc.", "return", "null", ";", "}", "long", "len", "=", "getRequest", "(", ")", ".", "getContentLength", "(", ")", ";", "long", "num", "=", "getNumBytesWritten", "(", ")", ";", "if", "(", "HeaderStorage", ".", "NOTSET", "!=", "len", "&&", "num", "!=", "len", ")", "{", "// content-length does not match the number of bytes sent, have to", "// close the connection since the other end won't be able to read", "// the body properly", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "{", "Tr", ".", "debug", "(", "tc", ",", "\"Request had content-length of \"", "+", "len", "+", "\" but sent \"", "+", "num", ")", ";", "}", "setPersistent", "(", "false", ")", ";", "return", "new", "HttpInvalidMessageException", "(", "\"Request length \"", "+", "len", "+", "\" but sent \"", "+", "num", ")", ";", "}", "return", "null", ";", "}" ]
Once we've fully written the request message, do any final checks to verify it's correctness. If something was incorrect, then an exception will be handed to the caller and that should be passed along to the application channel above. @return HttpInvalidMessageException (null if it was valid)
[ "Once", "we", "ve", "fully", "written", "the", "request", "message", "do", "any", "final", "checks", "to", "verify", "it", "s", "correctness", ".", "If", "something", "was", "incorrect", "then", "an", "exception", "will", "be", "handed", "to", "the", "caller", "and", "that", "should", "be", "passed", "along", "to", "the", "application", "channel", "above", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/internal/outbound/HttpOutboundServiceContextImpl.java#L1362-L1381
train
OpenLiberty/open-liberty
dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/internal/outbound/HttpOutboundServiceContextImpl.java
HttpOutboundServiceContextImpl.parseResponseMessageAsync
VirtualConnection parseResponseMessageAsync() { VirtualConnection readVC = null; try { do { if (parseMessage()) { // finished parsing the message return getVC(); } if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Reading for more data to parse"); } // configure the buffers for reading setupReadBuffers(getHttpConfig().getIncomingHdrBufferSize(), false); readVC = getTSC().getReadInterface().read(1, HttpOSCReadCallback.getRef(), false, getReadTimeout()); } while (null != readVC); } catch (Exception e) { // no FFDC required if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Exception while parsing response: " + e); } setPersistent(false); // LI4335 - early reads also use read callback if (this.bEarlyReads || this.bTempResponsesUsed) { getAppReadCallback().error(getVC(), e); } else { getAppWriteCallback().error(getVC(), e); } return null; } // getting here means an async read is in-progress return null; }
java
VirtualConnection parseResponseMessageAsync() { VirtualConnection readVC = null; try { do { if (parseMessage()) { // finished parsing the message return getVC(); } if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Reading for more data to parse"); } // configure the buffers for reading setupReadBuffers(getHttpConfig().getIncomingHdrBufferSize(), false); readVC = getTSC().getReadInterface().read(1, HttpOSCReadCallback.getRef(), false, getReadTimeout()); } while (null != readVC); } catch (Exception e) { // no FFDC required if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Exception while parsing response: " + e); } setPersistent(false); // LI4335 - early reads also use read callback if (this.bEarlyReads || this.bTempResponsesUsed) { getAppReadCallback().error(getVC(), e); } else { getAppWriteCallback().error(getVC(), e); } return null; } // getting here means an async read is in-progress return null; }
[ "VirtualConnection", "parseResponseMessageAsync", "(", ")", "{", "VirtualConnection", "readVC", "=", "null", ";", "try", "{", "do", "{", "if", "(", "parseMessage", "(", ")", ")", "{", "// finished parsing the message", "return", "getVC", "(", ")", ";", "}", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "{", "Tr", ".", "debug", "(", "tc", ",", "\"Reading for more data to parse\"", ")", ";", "}", "// configure the buffers for reading", "setupReadBuffers", "(", "getHttpConfig", "(", ")", ".", "getIncomingHdrBufferSize", "(", ")", ",", "false", ")", ";", "readVC", "=", "getTSC", "(", ")", ".", "getReadInterface", "(", ")", ".", "read", "(", "1", ",", "HttpOSCReadCallback", ".", "getRef", "(", ")", ",", "false", ",", "getReadTimeout", "(", ")", ")", ";", "}", "while", "(", "null", "!=", "readVC", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "// no FFDC required", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "{", "Tr", ".", "debug", "(", "tc", ",", "\"Exception while parsing response: \"", "+", "e", ")", ";", "}", "setPersistent", "(", "false", ")", ";", "// LI4335 - early reads also use read callback", "if", "(", "this", ".", "bEarlyReads", "||", "this", ".", "bTempResponsesUsed", ")", "{", "getAppReadCallback", "(", ")", ".", "error", "(", "getVC", "(", ")", ",", "e", ")", ";", "}", "else", "{", "getAppWriteCallback", "(", ")", ".", "error", "(", "getVC", "(", ")", ",", "e", ")", ";", "}", "return", "null", ";", "}", "// getting here means an async read is in-progress", "return", "null", ";", "}" ]
Method to clean the service context and read another response message asynchronously. This will return a non-null virtual connection object if the new response message is fully parsed with no async reads needed. Otherwise, it will return null and a callback will be used later. @return VirtualConnection
[ "Method", "to", "clean", "the", "service", "context", "and", "read", "another", "response", "message", "asynchronously", ".", "This", "will", "return", "a", "non", "-", "null", "virtual", "connection", "object", "if", "the", "new", "response", "message", "is", "fully", "parsed", "with", "no", "async", "reads", "needed", ".", "Otherwise", "it", "will", "return", "null", "and", "a", "callback", "will", "be", "used", "later", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/internal/outbound/HttpOutboundServiceContextImpl.java#L1565-L1598
train
OpenLiberty/open-liberty
dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/internal/outbound/HttpOutboundServiceContextImpl.java
HttpOutboundServiceContextImpl.parseResponseMessageSync
private void parseResponseMessageSync() throws IOException { // if read buffers are available, then attempt a parse otherwise go // into the "read data then parse" loop if (isReadDataAvailable()) { try { // if data is already available, don't modify the buffer if (parseMessage()) { this.numResponsesReceived++; return; } } catch (IOException ioe) { // no FFDC required if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "IOException while parsing response: " + ioe); } throw ioe; } catch (Exception e) { // no FFDC required if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Exception while parsing response: " + e); } throw new IOException(e.getMessage(), e); } } // keep reading and parsing until we're done while (true) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Reading for data to parse"); } try { // configure the buffers for reading setupReadBuffers(getHttpConfig().getIncomingHdrBufferSize(), false); getTSC().getReadInterface().read(1, getReadTimeout()); } catch (IOException ioe) { // no FFDC required if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Exception while reading response: " + ioe); } reConnect(ioe); } try { if (parseMessage()) { // finished parsing the message this.numResponsesReceived++; return; } } catch (IOException ioe) { // no FFDC required if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "IOException while parsing response: " + ioe); } throw ioe; } catch (Exception e) { // no FFDC required if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Exception while parsing response: " + e); } throw new IOException(e.getMessage(), e); } } }
java
private void parseResponseMessageSync() throws IOException { // if read buffers are available, then attempt a parse otherwise go // into the "read data then parse" loop if (isReadDataAvailable()) { try { // if data is already available, don't modify the buffer if (parseMessage()) { this.numResponsesReceived++; return; } } catch (IOException ioe) { // no FFDC required if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "IOException while parsing response: " + ioe); } throw ioe; } catch (Exception e) { // no FFDC required if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Exception while parsing response: " + e); } throw new IOException(e.getMessage(), e); } } // keep reading and parsing until we're done while (true) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Reading for data to parse"); } try { // configure the buffers for reading setupReadBuffers(getHttpConfig().getIncomingHdrBufferSize(), false); getTSC().getReadInterface().read(1, getReadTimeout()); } catch (IOException ioe) { // no FFDC required if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Exception while reading response: " + ioe); } reConnect(ioe); } try { if (parseMessage()) { // finished parsing the message this.numResponsesReceived++; return; } } catch (IOException ioe) { // no FFDC required if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "IOException while parsing response: " + ioe); } throw ioe; } catch (Exception e) { // no FFDC required if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Exception while parsing response: " + e); } throw new IOException(e.getMessage(), e); } } }
[ "private", "void", "parseResponseMessageSync", "(", ")", "throws", "IOException", "{", "// if read buffers are available, then attempt a parse otherwise go", "// into the \"read data then parse\" loop", "if", "(", "isReadDataAvailable", "(", ")", ")", "{", "try", "{", "// if data is already available, don't modify the buffer", "if", "(", "parseMessage", "(", ")", ")", "{", "this", ".", "numResponsesReceived", "++", ";", "return", ";", "}", "}", "catch", "(", "IOException", "ioe", ")", "{", "// no FFDC required", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "{", "Tr", ".", "debug", "(", "tc", ",", "\"IOException while parsing response: \"", "+", "ioe", ")", ";", "}", "throw", "ioe", ";", "}", "catch", "(", "Exception", "e", ")", "{", "// no FFDC required", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "{", "Tr", ".", "debug", "(", "tc", ",", "\"Exception while parsing response: \"", "+", "e", ")", ";", "}", "throw", "new", "IOException", "(", "e", ".", "getMessage", "(", ")", ",", "e", ")", ";", "}", "}", "// keep reading and parsing until we're done", "while", "(", "true", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "{", "Tr", ".", "debug", "(", "tc", ",", "\"Reading for data to parse\"", ")", ";", "}", "try", "{", "// configure the buffers for reading", "setupReadBuffers", "(", "getHttpConfig", "(", ")", ".", "getIncomingHdrBufferSize", "(", ")", ",", "false", ")", ";", "getTSC", "(", ")", ".", "getReadInterface", "(", ")", ".", "read", "(", "1", ",", "getReadTimeout", "(", ")", ")", ";", "}", "catch", "(", "IOException", "ioe", ")", "{", "// no FFDC required", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "{", "Tr", ".", "debug", "(", "tc", ",", "\"Exception while reading response: \"", "+", "ioe", ")", ";", "}", "reConnect", "(", "ioe", ")", ";", "}", "try", "{", "if", "(", "parseMessage", "(", ")", ")", "{", "// finished parsing the message", "this", ".", "numResponsesReceived", "++", ";", "return", ";", "}", "}", "catch", "(", "IOException", "ioe", ")", "{", "// no FFDC required", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "{", "Tr", ".", "debug", "(", "tc", ",", "\"IOException while parsing response: \"", "+", "ioe", ")", ";", "}", "throw", "ioe", ";", "}", "catch", "(", "Exception", "e", ")", "{", "// no FFDC required", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "{", "Tr", ".", "debug", "(", "tc", ",", "\"Exception while parsing response: \"", "+", "e", ")", ";", "}", "throw", "new", "IOException", "(", "e", ".", "getMessage", "(", ")", ",", "e", ")", ";", "}", "}", "}" ]
Method to read for a response message synchronously. This will return when the message headers are completely parsed, or throw an exception if an error occurs. This method does not contain any logic on what to do with the response, it just wraps the reading and parsing stage. @throws IOException
[ "Method", "to", "read", "for", "a", "response", "message", "synchronously", ".", "This", "will", "return", "when", "the", "message", "headers", "are", "completely", "parsed", "or", "throw", "an", "exception", "if", "an", "error", "occurs", ".", "This", "method", "does", "not", "contain", "any", "logic", "on", "what", "to", "do", "with", "the", "response", "it", "just", "wraps", "the", "reading", "and", "parsing", "stage", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/internal/outbound/HttpOutboundServiceContextImpl.java#L1608-L1670
train
OpenLiberty/open-liberty
dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/internal/outbound/HttpOutboundServiceContextImpl.java
HttpOutboundServiceContextImpl.checkBodyValidity
private boolean checkBodyValidity() throws IOException { // LI4335 - allow response body reading if early reads are in place if (isImmediateReadEnabled() || this.bEarlyReads) { if (!headersParsed()) { // this means they are requesting body buffers prior to sending // the minimum request headers IOException ioe = new IOException("Request headers not sent yet"); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Attempt to read response prior to sendRequest"); } throw ioe; } // otherwise continue as normal } else if (!isMessageSent()) { // request message must be fully sent prior to reading any part of // the response body IOException ioe = new IOException("Request not finished yet"); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Attempt to read response prior to finishRequest"); } throw ioe; } // check to see if we should be reading for data return isIncomingBodyValid(); }
java
private boolean checkBodyValidity() throws IOException { // LI4335 - allow response body reading if early reads are in place if (isImmediateReadEnabled() || this.bEarlyReads) { if (!headersParsed()) { // this means they are requesting body buffers prior to sending // the minimum request headers IOException ioe = new IOException("Request headers not sent yet"); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Attempt to read response prior to sendRequest"); } throw ioe; } // otherwise continue as normal } else if (!isMessageSent()) { // request message must be fully sent prior to reading any part of // the response body IOException ioe = new IOException("Request not finished yet"); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Attempt to read response prior to finishRequest"); } throw ioe; } // check to see if we should be reading for data return isIncomingBodyValid(); }
[ "private", "boolean", "checkBodyValidity", "(", ")", "throws", "IOException", "{", "// LI4335 - allow response body reading if early reads are in place", "if", "(", "isImmediateReadEnabled", "(", ")", "||", "this", ".", "bEarlyReads", ")", "{", "if", "(", "!", "headersParsed", "(", ")", ")", "{", "// this means they are requesting body buffers prior to sending", "// the minimum request headers", "IOException", "ioe", "=", "new", "IOException", "(", "\"Request headers not sent yet\"", ")", ";", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "{", "Tr", ".", "debug", "(", "tc", ",", "\"Attempt to read response prior to sendRequest\"", ")", ";", "}", "throw", "ioe", ";", "}", "// otherwise continue as normal", "}", "else", "if", "(", "!", "isMessageSent", "(", ")", ")", "{", "// request message must be fully sent prior to reading any part of", "// the response body", "IOException", "ioe", "=", "new", "IOException", "(", "\"Request not finished yet\"", ")", ";", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "{", "Tr", ".", "debug", "(", "tc", ",", "\"Attempt to read response prior to finishRequest\"", ")", ";", "}", "throw", "ioe", ";", "}", "// check to see if we should be reading for data", "return", "isIncomingBodyValid", "(", ")", ";", "}" ]
Utility method to check whether the upcoming read for the response body is either valid at this point or even necessary. @return boolean -- false means there is no need to read for a body @throws IOException -- if this not a valid time to get the body
[ "Utility", "method", "to", "check", "whether", "the", "upcoming", "read", "for", "the", "response", "body", "is", "either", "valid", "at", "this", "point", "or", "even", "necessary", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/internal/outbound/HttpOutboundServiceContextImpl.java#L1783-L1808
train
OpenLiberty/open-liberty
dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/internal/outbound/HttpOutboundServiceContextImpl.java
HttpOutboundServiceContextImpl.wakeupReadAhead
protected void wakeupReadAhead() { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Received synchronous read-ahead wake-up call."); } synchronized (this.readAheadSyncer) { this.readAheadSyncer.notify(); } }
java
protected void wakeupReadAhead() { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Received synchronous read-ahead wake-up call."); } synchronized (this.readAheadSyncer) { this.readAheadSyncer.notify(); } }
[ "protected", "void", "wakeupReadAhead", "(", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "{", "Tr", ".", "debug", "(", "tc", ",", "\"Received synchronous read-ahead wake-up call.\"", ")", ";", "}", "synchronized", "(", "this", ".", "readAheadSyncer", ")", "{", "this", ".", "readAheadSyncer", ".", "notify", "(", ")", ";", "}", "}" ]
Method used by the read-ahead callback thread to notify this service context that the read has completed.
[ "Method", "used", "by", "the", "read", "-", "ahead", "callback", "thread", "to", "notify", "this", "service", "context", "that", "the", "read", "has", "completed", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/internal/outbound/HttpOutboundServiceContextImpl.java#L2529-L2536
train
OpenLiberty/open-liberty
dev/com.ibm.ws.security.wim.core/src/com/ibm/ws/security/wim/ProfileManager.java
ProfileManager.prepareForCaller
private void prepareForCaller(IdentifierType id, String qualifiedEntityType, String uid, String uName, boolean isIgnoreRepositoryErrors, Set<String> failureRepositoryIds) throws WIMException { String METHODNAME = "prepareForCaller"; if (id != null) { String externalId = id.getExternalId(); if (tc.isDebugEnabled()) { Tr.debug(tc, METHODNAME + " prepare identifier for caller, set [uniqueId=" + externalId + "]"); } if (externalId != null) { id.setUniqueId(externalId); } id.setExternalId(null); } }
java
private void prepareForCaller(IdentifierType id, String qualifiedEntityType, String uid, String uName, boolean isIgnoreRepositoryErrors, Set<String> failureRepositoryIds) throws WIMException { String METHODNAME = "prepareForCaller"; if (id != null) { String externalId = id.getExternalId(); if (tc.isDebugEnabled()) { Tr.debug(tc, METHODNAME + " prepare identifier for caller, set [uniqueId=" + externalId + "]"); } if (externalId != null) { id.setUniqueId(externalId); } id.setExternalId(null); } }
[ "private", "void", "prepareForCaller", "(", "IdentifierType", "id", ",", "String", "qualifiedEntityType", ",", "String", "uid", ",", "String", "uName", ",", "boolean", "isIgnoreRepositoryErrors", ",", "Set", "<", "String", ">", "failureRepositoryIds", ")", "throws", "WIMException", "{", "String", "METHODNAME", "=", "\"prepareForCaller\"", ";", "if", "(", "id", "!=", "null", ")", "{", "String", "externalId", "=", "id", ".", "getExternalId", "(", ")", ";", "if", "(", "tc", ".", "isDebugEnabled", "(", ")", ")", "{", "Tr", ".", "debug", "(", "tc", ",", "METHODNAME", "+", "\" prepare identifier for caller, set [uniqueId=\"", "+", "externalId", "+", "\"]\"", ")", ";", "}", "if", "(", "externalId", "!=", "null", ")", "{", "id", ".", "setUniqueId", "(", "externalId", ")", ";", "}", "id", ".", "setExternalId", "(", "null", ")", ";", "}", "}" ]
prepare the identifier DataObject for caller. @param id the identifier DataObject @param qualifiedEntityType the qualified entity type of the identifier represented entity @param uid unique ID of the entity before updating operation (the should be only specified for update operation, for other operations, set the uid to null) @param uName unique name of the entity before updating operation (the should be only specified for update operation, for other operations, set the uName to null) @throws WIMException
[ "prepare", "the", "identifier", "DataObject", "for", "caller", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.wim.core/src/com/ibm/ws/security/wim/ProfileManager.java#L2056-L2073
train
OpenLiberty/open-liberty
dev/com.ibm.ws.security.wim.core/src/com/ibm/ws/security/wim/ProfileManager.java
ProfileManager.innerRetrieveEntityFromRepository
private Entity innerRetrieveEntityFromRepository(Root root, Entity retEntDO, String uniqueId, boolean isAllowOperationIfReposDown, Set<String> failureRepositoryIds) throws WIMException { String METHODNAME = "retrieveEntityFromRepository"; List<String> reposIds = getRepositoryManager().getRepoIds(); for (int i = 0; (i < reposIds.size() && retEntDO == null); i++) { String reposId = reposIds.get(i); try { Root retRoot = getRepositoryManager().getRepository(reposId).get(root); if (retRoot != null) { List<Entity> entList = retRoot.getEntities(); if (entList.size() >= 1) { retEntDO = entList.get(0); } } } catch (EntityNotFoundException e) { if (tc.isDebugEnabled()) { Tr.debug(tc, METHODNAME + " EntityNotFoundException[reposId=" + reposId + "] - " + uniqueId); } } catch (WIMSystemException wse) { String message = wse.getMessage(); if (tc.isDebugEnabled()) { Tr.debug(tc, METHODNAME + " WSE message = " + message); } if (message != null && message.contains("CWIML4520E") && message.contains("javax.naming.InvalidNameException")) { if (tc.isDebugEnabled()) { Tr.debug(tc, METHODNAME + " WIMSystemException [reposId=" + reposId + "] - " + message); } } else throw wse; } catch (Exception e) { if (!isAllowOperationIfReposDown) { if (e instanceof WIMException) { throw (WIMException) e; } throw new WIMException(e); } else { if (tc.isDebugEnabled()) Tr.debug(tc, METHODNAME + " IGNORE: exception [" + e.getMessage() + "] when retrieve entity from repository [" + reposId + "]"); failureRepositoryIds.add(reposId); } } } return retEntDO; }
java
private Entity innerRetrieveEntityFromRepository(Root root, Entity retEntDO, String uniqueId, boolean isAllowOperationIfReposDown, Set<String> failureRepositoryIds) throws WIMException { String METHODNAME = "retrieveEntityFromRepository"; List<String> reposIds = getRepositoryManager().getRepoIds(); for (int i = 0; (i < reposIds.size() && retEntDO == null); i++) { String reposId = reposIds.get(i); try { Root retRoot = getRepositoryManager().getRepository(reposId).get(root); if (retRoot != null) { List<Entity> entList = retRoot.getEntities(); if (entList.size() >= 1) { retEntDO = entList.get(0); } } } catch (EntityNotFoundException e) { if (tc.isDebugEnabled()) { Tr.debug(tc, METHODNAME + " EntityNotFoundException[reposId=" + reposId + "] - " + uniqueId); } } catch (WIMSystemException wse) { String message = wse.getMessage(); if (tc.isDebugEnabled()) { Tr.debug(tc, METHODNAME + " WSE message = " + message); } if (message != null && message.contains("CWIML4520E") && message.contains("javax.naming.InvalidNameException")) { if (tc.isDebugEnabled()) { Tr.debug(tc, METHODNAME + " WIMSystemException [reposId=" + reposId + "] - " + message); } } else throw wse; } catch (Exception e) { if (!isAllowOperationIfReposDown) { if (e instanceof WIMException) { throw (WIMException) e; } throw new WIMException(e); } else { if (tc.isDebugEnabled()) Tr.debug(tc, METHODNAME + " IGNORE: exception [" + e.getMessage() + "] when retrieve entity from repository [" + reposId + "]"); failureRepositoryIds.add(reposId); } } } return retEntDO; }
[ "private", "Entity", "innerRetrieveEntityFromRepository", "(", "Root", "root", ",", "Entity", "retEntDO", ",", "String", "uniqueId", ",", "boolean", "isAllowOperationIfReposDown", ",", "Set", "<", "String", ">", "failureRepositoryIds", ")", "throws", "WIMException", "{", "String", "METHODNAME", "=", "\"retrieveEntityFromRepository\"", ";", "List", "<", "String", ">", "reposIds", "=", "getRepositoryManager", "(", ")", ".", "getRepoIds", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "(", "i", "<", "reposIds", ".", "size", "(", ")", "&&", "retEntDO", "==", "null", ")", ";", "i", "++", ")", "{", "String", "reposId", "=", "reposIds", ".", "get", "(", "i", ")", ";", "try", "{", "Root", "retRoot", "=", "getRepositoryManager", "(", ")", ".", "getRepository", "(", "reposId", ")", ".", "get", "(", "root", ")", ";", "if", "(", "retRoot", "!=", "null", ")", "{", "List", "<", "Entity", ">", "entList", "=", "retRoot", ".", "getEntities", "(", ")", ";", "if", "(", "entList", ".", "size", "(", ")", ">=", "1", ")", "{", "retEntDO", "=", "entList", ".", "get", "(", "0", ")", ";", "}", "}", "}", "catch", "(", "EntityNotFoundException", "e", ")", "{", "if", "(", "tc", ".", "isDebugEnabled", "(", ")", ")", "{", "Tr", ".", "debug", "(", "tc", ",", "METHODNAME", "+", "\" EntityNotFoundException[reposId=\"", "+", "reposId", "+", "\"] - \"", "+", "uniqueId", ")", ";", "}", "}", "catch", "(", "WIMSystemException", "wse", ")", "{", "String", "message", "=", "wse", ".", "getMessage", "(", ")", ";", "if", "(", "tc", ".", "isDebugEnabled", "(", ")", ")", "{", "Tr", ".", "debug", "(", "tc", ",", "METHODNAME", "+", "\" WSE message = \"", "+", "message", ")", ";", "}", "if", "(", "message", "!=", "null", "&&", "message", ".", "contains", "(", "\"CWIML4520E\"", ")", "&&", "message", ".", "contains", "(", "\"javax.naming.InvalidNameException\"", ")", ")", "{", "if", "(", "tc", ".", "isDebugEnabled", "(", ")", ")", "{", "Tr", ".", "debug", "(", "tc", ",", "METHODNAME", "+", "\" WIMSystemException [reposId=\"", "+", "reposId", "+", "\"] - \"", "+", "message", ")", ";", "}", "}", "else", "throw", "wse", ";", "}", "catch", "(", "Exception", "e", ")", "{", "if", "(", "!", "isAllowOperationIfReposDown", ")", "{", "if", "(", "e", "instanceof", "WIMException", ")", "{", "throw", "(", "WIMException", ")", "e", ";", "}", "throw", "new", "WIMException", "(", "e", ")", ";", "}", "else", "{", "if", "(", "tc", ".", "isDebugEnabled", "(", ")", ")", "Tr", ".", "debug", "(", "tc", ",", "METHODNAME", "+", "\" IGNORE: exception [\"", "+", "e", ".", "getMessage", "(", ")", "+", "\"] when retrieve entity from repository [\"", "+", "reposId", "+", "\"]\"", ")", ";", "failureRepositoryIds", ".", "add", "(", "reposId", ")", ";", "}", "}", "}", "return", "retEntDO", ";", "}" ]
Method created so we can ffdc the inner EntityNotFoundException
[ "Method", "created", "so", "we", "can", "ffdc", "the", "inner", "EntityNotFoundException" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.wim.core/src/com/ibm/ws/security/wim/ProfileManager.java#L2226-L2274
train
OpenLiberty/open-liberty
dev/com.ibm.ws.security.wim.core/src/com/ibm/ws/security/wim/ProfileManager.java
ProfileManager.getRealmNameOrFirstBest
private String getRealmNameOrFirstBest(Root root) { String value = null; value = getRealmName(root); if (value == null) { try { value = getRealmName(); } catch (Exception e) { // leave realm at null } } return value; }
java
private String getRealmNameOrFirstBest(Root root) { String value = null; value = getRealmName(root); if (value == null) { try { value = getRealmName(); } catch (Exception e) { // leave realm at null } } return value; }
[ "private", "String", "getRealmNameOrFirstBest", "(", "Root", "root", ")", "{", "String", "value", "=", "null", ";", "value", "=", "getRealmName", "(", "root", ")", ";", "if", "(", "value", "==", "null", ")", "{", "try", "{", "value", "=", "getRealmName", "(", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "// leave realm at null", "}", "}", "return", "value", ";", "}" ]
First try to get the default or primary realm defined. If not found, then use the realm name from one of the registries. Added for populating audit records. @param root @return
[ "First", "try", "to", "get", "the", "default", "or", "primary", "realm", "defined", ".", "If", "not", "found", "then", "use", "the", "realm", "name", "from", "one", "of", "the", "registries", ".", "Added", "for", "populating", "audit", "records", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.wim.core/src/com/ibm/ws/security/wim/ProfileManager.java#L2464-L2475
train
OpenLiberty/open-liberty
dev/com.ibm.ws.security.wim.core/src/com/ibm/ws/security/wim/ProfileManager.java
ProfileManager.getUniqueNameByUniqueId
@FFDCIgnore({ EntityNotFoundException.class, Exception.class }) private String getUniqueNameByUniqueId(String uniqueId, boolean isAllowOperationIfReposDown, Set<String> failureRepositoryIds) throws WIMException { final String METHODNAME = "getUniqueNameByUniqueId"; String uniqueName = null; boolean found = false; int i = 0; Root temp = new Root(); Entity entity = new Entity(); IdentifierType id = new IdentifierType(); id.setExternalId(uniqueId); entity.setIdentifier(id); temp.getEntities().add(entity); List<String> repositoryIds = repositoryManager.getRepoIds(); while (i < repositoryIds.size() && !found) { try { Root returnedRoot = repositoryManager.getRepository(repositoryIds.get(i)).get(temp); if (returnedRoot != null) { List<Entity> pes = returnedRoot.getEntities(); if (pes != null) { Entity ent = pes.get(0); if (ent != null) { IdentifierType entityId = ent.getIdentifier(); if (entityId != null) { uniqueName = entityId.getUniqueName(); found = true; } } } } } catch (EntityNotFoundException e) { // Move on to the next repository i++; } catch (Exception e) { if (!isAllowOperationIfReposDown) { if (e instanceof WIMException) { throw (WIMException) e; } throw new WIMException(e); } else { if (tc.isDebugEnabled()) Tr.debug(tc, METHODNAME + " IGNORE: exception [" + e.getMessage() + "] on repository [" + repositoryIds.get(i) + "]"); failureRepositoryIds.add(repositoryIds.get(i)); // Move on to the next repository i++; } } } return uniqueName; }
java
@FFDCIgnore({ EntityNotFoundException.class, Exception.class }) private String getUniqueNameByUniqueId(String uniqueId, boolean isAllowOperationIfReposDown, Set<String> failureRepositoryIds) throws WIMException { final String METHODNAME = "getUniqueNameByUniqueId"; String uniqueName = null; boolean found = false; int i = 0; Root temp = new Root(); Entity entity = new Entity(); IdentifierType id = new IdentifierType(); id.setExternalId(uniqueId); entity.setIdentifier(id); temp.getEntities().add(entity); List<String> repositoryIds = repositoryManager.getRepoIds(); while (i < repositoryIds.size() && !found) { try { Root returnedRoot = repositoryManager.getRepository(repositoryIds.get(i)).get(temp); if (returnedRoot != null) { List<Entity> pes = returnedRoot.getEntities(); if (pes != null) { Entity ent = pes.get(0); if (ent != null) { IdentifierType entityId = ent.getIdentifier(); if (entityId != null) { uniqueName = entityId.getUniqueName(); found = true; } } } } } catch (EntityNotFoundException e) { // Move on to the next repository i++; } catch (Exception e) { if (!isAllowOperationIfReposDown) { if (e instanceof WIMException) { throw (WIMException) e; } throw new WIMException(e); } else { if (tc.isDebugEnabled()) Tr.debug(tc, METHODNAME + " IGNORE: exception [" + e.getMessage() + "] on repository [" + repositoryIds.get(i) + "]"); failureRepositoryIds.add(repositoryIds.get(i)); // Move on to the next repository i++; } } } return uniqueName; }
[ "@", "FFDCIgnore", "(", "{", "EntityNotFoundException", ".", "class", ",", "Exception", ".", "class", "}", ")", "private", "String", "getUniqueNameByUniqueId", "(", "String", "uniqueId", ",", "boolean", "isAllowOperationIfReposDown", ",", "Set", "<", "String", ">", "failureRepositoryIds", ")", "throws", "WIMException", "{", "final", "String", "METHODNAME", "=", "\"getUniqueNameByUniqueId\"", ";", "String", "uniqueName", "=", "null", ";", "boolean", "found", "=", "false", ";", "int", "i", "=", "0", ";", "Root", "temp", "=", "new", "Root", "(", ")", ";", "Entity", "entity", "=", "new", "Entity", "(", ")", ";", "IdentifierType", "id", "=", "new", "IdentifierType", "(", ")", ";", "id", ".", "setExternalId", "(", "uniqueId", ")", ";", "entity", ".", "setIdentifier", "(", "id", ")", ";", "temp", ".", "getEntities", "(", ")", ".", "add", "(", "entity", ")", ";", "List", "<", "String", ">", "repositoryIds", "=", "repositoryManager", ".", "getRepoIds", "(", ")", ";", "while", "(", "i", "<", "repositoryIds", ".", "size", "(", ")", "&&", "!", "found", ")", "{", "try", "{", "Root", "returnedRoot", "=", "repositoryManager", ".", "getRepository", "(", "repositoryIds", ".", "get", "(", "i", ")", ")", ".", "get", "(", "temp", ")", ";", "if", "(", "returnedRoot", "!=", "null", ")", "{", "List", "<", "Entity", ">", "pes", "=", "returnedRoot", ".", "getEntities", "(", ")", ";", "if", "(", "pes", "!=", "null", ")", "{", "Entity", "ent", "=", "pes", ".", "get", "(", "0", ")", ";", "if", "(", "ent", "!=", "null", ")", "{", "IdentifierType", "entityId", "=", "ent", ".", "getIdentifier", "(", ")", ";", "if", "(", "entityId", "!=", "null", ")", "{", "uniqueName", "=", "entityId", ".", "getUniqueName", "(", ")", ";", "found", "=", "true", ";", "}", "}", "}", "}", "}", "catch", "(", "EntityNotFoundException", "e", ")", "{", "// Move on to the next repository", "i", "++", ";", "}", "catch", "(", "Exception", "e", ")", "{", "if", "(", "!", "isAllowOperationIfReposDown", ")", "{", "if", "(", "e", "instanceof", "WIMException", ")", "{", "throw", "(", "WIMException", ")", "e", ";", "}", "throw", "new", "WIMException", "(", "e", ")", ";", "}", "else", "{", "if", "(", "tc", ".", "isDebugEnabled", "(", ")", ")", "Tr", ".", "debug", "(", "tc", ",", "METHODNAME", "+", "\" IGNORE: exception [\"", "+", "e", ".", "getMessage", "(", ")", "+", "\"] on repository [\"", "+", "repositoryIds", ".", "get", "(", "i", ")", "+", "\"]\"", ")", ";", "failureRepositoryIds", ".", "add", "(", "repositoryIds", ".", "get", "(", "i", ")", ")", ";", "// Move on to the next repository", "i", "++", ";", "}", "}", "}", "return", "uniqueName", ";", "}" ]
Get the uniqueName based on the specified uniqueId @param uniqueId the unique ID of an entity @return the unique name of the entity which has the specified unique ID @throws WIMException
[ "Get", "the", "uniqueName", "based", "on", "the", "specified", "uniqueId" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.wim.core/src/com/ibm/ws/security/wim/ProfileManager.java#L3335-L3387
train
OpenLiberty/open-liberty
dev/com.ibm.ws.repository.resolver/src/com/ibm/ws/repository/resolver/RepositoryResolver.java
RepositoryResolver.initResolve
void initResolve() { featureNamesToResolve = new HashSet<>(); samplesToInstall = new ArrayList<>(); resolvedFeatures = new HashMap<>(); requestedFeatureNames = new HashSet<>(); featuresMissing = new ArrayList<>(); resourcesWrongProduct = new ArrayList<>(); requirementsFoundForOtherProducts = new HashSet<>(); missingTopLevelRequirements = new ArrayList<>(); missingRequirements = new ArrayList<>(); resolverRepository.clearPreferredVersions(); }
java
void initResolve() { featureNamesToResolve = new HashSet<>(); samplesToInstall = new ArrayList<>(); resolvedFeatures = new HashMap<>(); requestedFeatureNames = new HashSet<>(); featuresMissing = new ArrayList<>(); resourcesWrongProduct = new ArrayList<>(); requirementsFoundForOtherProducts = new HashSet<>(); missingTopLevelRequirements = new ArrayList<>(); missingRequirements = new ArrayList<>(); resolverRepository.clearPreferredVersions(); }
[ "void", "initResolve", "(", ")", "{", "featureNamesToResolve", "=", "new", "HashSet", "<>", "(", ")", ";", "samplesToInstall", "=", "new", "ArrayList", "<>", "(", ")", ";", "resolvedFeatures", "=", "new", "HashMap", "<>", "(", ")", ";", "requestedFeatureNames", "=", "new", "HashSet", "<>", "(", ")", ";", "featuresMissing", "=", "new", "ArrayList", "<>", "(", ")", ";", "resourcesWrongProduct", "=", "new", "ArrayList", "<>", "(", ")", ";", "requirementsFoundForOtherProducts", "=", "new", "HashSet", "<>", "(", ")", ";", "missingTopLevelRequirements", "=", "new", "ArrayList", "<>", "(", ")", ";", "missingRequirements", "=", "new", "ArrayList", "<>", "(", ")", ";", "resolverRepository", ".", "clearPreferredVersions", "(", ")", ";", "}" ]
Initialize all the fields used for a resolution
[ "Initialize", "all", "the", "fields", "used", "for", "a", "resolution" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.repository.resolver/src/com/ibm/ws/repository/resolver/RepositoryResolver.java#L337-L348
train
OpenLiberty/open-liberty
dev/com.ibm.ws.repository.resolver/src/com/ibm/ws/repository/resolver/RepositoryResolver.java
RepositoryResolver.createInstallLists
List<List<RepositoryResource>> createInstallLists() { List<List<RepositoryResource>> installLists = new ArrayList<>(); // Create install list for each sample for (SampleResource sample : samplesToInstall) { installLists.add(createInstallList(sample)); } // Create install list for each requested feature for (String featureName : requestedFeatureNames) { List<RepositoryResource> installList = createInstallList(featureName); // May get an empty list if the requested feature is already installed if (!installList.isEmpty()) { installLists.add(installList); } } // Create install list for each autofeature which wasn't explicitly requested (otherwise we'd have covered it above) and isn't already installed for (ProvisioningFeatureDefinition feature : resolvedFeatures.values()) { if (feature.isAutoFeature() && !requestedFeatureNames.contains(feature.getSymbolicName()) && feature instanceof KernelResolverEsa) { installLists.add(createInstallList(feature.getSymbolicName())); } } return installLists; }
java
List<List<RepositoryResource>> createInstallLists() { List<List<RepositoryResource>> installLists = new ArrayList<>(); // Create install list for each sample for (SampleResource sample : samplesToInstall) { installLists.add(createInstallList(sample)); } // Create install list for each requested feature for (String featureName : requestedFeatureNames) { List<RepositoryResource> installList = createInstallList(featureName); // May get an empty list if the requested feature is already installed if (!installList.isEmpty()) { installLists.add(installList); } } // Create install list for each autofeature which wasn't explicitly requested (otherwise we'd have covered it above) and isn't already installed for (ProvisioningFeatureDefinition feature : resolvedFeatures.values()) { if (feature.isAutoFeature() && !requestedFeatureNames.contains(feature.getSymbolicName()) && feature instanceof KernelResolverEsa) { installLists.add(createInstallList(feature.getSymbolicName())); } } return installLists; }
[ "List", "<", "List", "<", "RepositoryResource", ">", ">", "createInstallLists", "(", ")", "{", "List", "<", "List", "<", "RepositoryResource", ">>", "installLists", "=", "new", "ArrayList", "<>", "(", ")", ";", "// Create install list for each sample", "for", "(", "SampleResource", "sample", ":", "samplesToInstall", ")", "{", "installLists", ".", "add", "(", "createInstallList", "(", "sample", ")", ")", ";", "}", "// Create install list for each requested feature", "for", "(", "String", "featureName", ":", "requestedFeatureNames", ")", "{", "List", "<", "RepositoryResource", ">", "installList", "=", "createInstallList", "(", "featureName", ")", ";", "// May get an empty list if the requested feature is already installed", "if", "(", "!", "installList", ".", "isEmpty", "(", ")", ")", "{", "installLists", ".", "add", "(", "installList", ")", ";", "}", "}", "// Create install list for each autofeature which wasn't explicitly requested (otherwise we'd have covered it above) and isn't already installed", "for", "(", "ProvisioningFeatureDefinition", "feature", ":", "resolvedFeatures", ".", "values", "(", ")", ")", "{", "if", "(", "feature", ".", "isAutoFeature", "(", ")", "&&", "!", "requestedFeatureNames", ".", "contains", "(", "feature", ".", "getSymbolicName", "(", ")", ")", "&&", "feature", "instanceof", "KernelResolverEsa", ")", "{", "installLists", ".", "add", "(", "createInstallList", "(", "feature", ".", "getSymbolicName", "(", ")", ")", ")", ";", "}", "}", "return", "installLists", ";", "}" ]
Create the install lists for the resources which we were asked to resolve @return the install lists
[ "Create", "the", "install", "lists", "for", "the", "resources", "which", "we", "were", "asked", "to", "resolve" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.repository.resolver/src/com/ibm/ws/repository/resolver/RepositoryResolver.java#L464-L489
train
OpenLiberty/open-liberty
dev/com.ibm.ws.recoverylog/src/com/ibm/ws/recoverylog/utils/RecoverableUnitIdTable.java
RecoverableUnitIdTable.nextId
public final synchronized long nextId(Object obj) { if (tc.isEntryEnabled()) Tr.entry(tc, "nextId", obj); long id = _idCount++; // Keep incrementing the id until we // find one that hasn't been reserved. while (_idMap.get(id) != null) { id = _idCount++; } // Add the new id to the map associating // it with the given object. _idMap.put(id, obj); if (tc.isEntryEnabled()) Tr.exit(tc, "nextId", new Long(id)); return id; }
java
public final synchronized long nextId(Object obj) { if (tc.isEntryEnabled()) Tr.entry(tc, "nextId", obj); long id = _idCount++; // Keep incrementing the id until we // find one that hasn't been reserved. while (_idMap.get(id) != null) { id = _idCount++; } // Add the new id to the map associating // it with the given object. _idMap.put(id, obj); if (tc.isEntryEnabled()) Tr.exit(tc, "nextId", new Long(id)); return id; }
[ "public", "final", "synchronized", "long", "nextId", "(", "Object", "obj", ")", "{", "if", "(", "tc", ".", "isEntryEnabled", "(", ")", ")", "Tr", ".", "entry", "(", "tc", ",", "\"nextId\"", ",", "obj", ")", ";", "long", "id", "=", "_idCount", "++", ";", "// Keep incrementing the id until we", "// find one that hasn't been reserved.", "while", "(", "_idMap", ".", "get", "(", "id", ")", "!=", "null", ")", "{", "id", "=", "_idCount", "++", ";", "}", "// Add the new id to the map associating", "// it with the given object.", "_idMap", ".", "put", "(", "id", ",", "obj", ")", ";", "if", "(", "tc", ".", "isEntryEnabled", "(", ")", ")", "Tr", ".", "exit", "(", "tc", ",", "\"nextId\"", ",", "new", "Long", "(", "id", ")", ")", ";", "return", "id", ";", "}" ]
Returns the next available id, starting from 1, and associates it with the given object. This method should be used during the creation of a new recoverable object. @param obj The object to be associated with the id @return The next available recoverable unit id
[ "Returns", "the", "next", "available", "id", "starting", "from", "1", "and", "associates", "it", "with", "the", "given", "object", ".", "This", "method", "should", "be", "used", "during", "the", "creation", "of", "a", "new", "recoverable", "object", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.recoverylog/src/com/ibm/ws/recoverylog/utils/RecoverableUnitIdTable.java#L35-L55
train
OpenLiberty/open-liberty
dev/com.ibm.ws.recoverylog/src/com/ibm/ws/recoverylog/utils/RecoverableUnitIdTable.java
RecoverableUnitIdTable.removeId
public final synchronized void removeId(long id) { if (tc.isEntryEnabled()) Tr.entry(tc, "removeId", new Long(id)); _idMap.remove(id); if (tc.isEntryEnabled()) Tr.exit(tc, "removeId"); }
java
public final synchronized void removeId(long id) { if (tc.isEntryEnabled()) Tr.entry(tc, "removeId", new Long(id)); _idMap.remove(id); if (tc.isEntryEnabled()) Tr.exit(tc, "removeId"); }
[ "public", "final", "synchronized", "void", "removeId", "(", "long", "id", ")", "{", "if", "(", "tc", ".", "isEntryEnabled", "(", ")", ")", "Tr", ".", "entry", "(", "tc", ",", "\"removeId\"", ",", "new", "Long", "(", "id", ")", ")", ";", "_idMap", ".", "remove", "(", "id", ")", ";", "if", "(", "tc", ".", "isEntryEnabled", "(", ")", ")", "Tr", ".", "exit", "(", "tc", ",", "\"removeId\"", ")", ";", "}" ]
Remove the given id from the map. This method should be called at the end of a recoverable object's lifetime. @param id The id to remove from the table
[ "Remove", "the", "given", "id", "from", "the", "map", ".", "This", "method", "should", "be", "called", "at", "the", "end", "of", "a", "recoverable", "object", "s", "lifetime", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.recoverylog/src/com/ibm/ws/recoverylog/utils/RecoverableUnitIdTable.java#L63-L70
train
OpenLiberty/open-liberty
dev/com.ibm.ws.recoverylog/src/com/ibm/ws/recoverylog/utils/RecoverableUnitIdTable.java
RecoverableUnitIdTable.reserveId
public final synchronized boolean reserveId(long id, Object obj) { if (tc.isEntryEnabled()) Tr.entry(tc, "reserveId", new Object[] {new Long(id), obj}); boolean reserved = false; // The id can only be reserved if it // isn't already in the map if (_idMap.get(id) == null) { _idMap.put(id, obj); reserved = true; } if (tc.isEntryEnabled()) Tr.exit(tc, "reserveId", new Boolean(reserved)); return reserved; }
java
public final synchronized boolean reserveId(long id, Object obj) { if (tc.isEntryEnabled()) Tr.entry(tc, "reserveId", new Object[] {new Long(id), obj}); boolean reserved = false; // The id can only be reserved if it // isn't already in the map if (_idMap.get(id) == null) { _idMap.put(id, obj); reserved = true; } if (tc.isEntryEnabled()) Tr.exit(tc, "reserveId", new Boolean(reserved)); return reserved; }
[ "public", "final", "synchronized", "boolean", "reserveId", "(", "long", "id", ",", "Object", "obj", ")", "{", "if", "(", "tc", ".", "isEntryEnabled", "(", ")", ")", "Tr", ".", "entry", "(", "tc", ",", "\"reserveId\"", ",", "new", "Object", "[", "]", "{", "new", "Long", "(", "id", ")", ",", "obj", "}", ")", ";", "boolean", "reserved", "=", "false", ";", "// The id can only be reserved if it", "// isn't already in the map", "if", "(", "_idMap", ".", "get", "(", "id", ")", "==", "null", ")", "{", "_idMap", ".", "put", "(", "id", ",", "obj", ")", ";", "reserved", "=", "true", ";", "}", "if", "(", "tc", ".", "isEntryEnabled", "(", ")", ")", "Tr", ".", "exit", "(", "tc", ",", "\"reserveId\"", ",", "new", "Boolean", "(", "reserved", ")", ")", ";", "return", "reserved", ";", "}" ]
Reserve the given id and associate it with the given object. This method should be used during recovery when there is a requirement to create a new object with a specific id rather than the one that is next available. @return true if the id was successfully reserved. @param id The value of the id to be reserved @param obj The object that requires the id
[ "Reserve", "the", "given", "id", "and", "associate", "it", "with", "the", "given", "object", ".", "This", "method", "should", "be", "used", "during", "recovery", "when", "there", "is", "a", "requirement", "to", "create", "a", "new", "object", "with", "a", "specific", "id", "rather", "than", "the", "one", "that", "is", "next", "available", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.recoverylog/src/com/ibm/ws/recoverylog/utils/RecoverableUnitIdTable.java#L83-L100
train
OpenLiberty/open-liberty
dev/com.ibm.ws.recoverylog/src/com/ibm/ws/recoverylog/utils/RecoverableUnitIdTable.java
RecoverableUnitIdTable.getAllObjects
public final synchronized Object[] getAllObjects() { if (tc.isEntryEnabled()) Tr.entry(tc, "getAllObjects"); Object[] values = _idMap.values(); if (tc.isEntryEnabled()) Tr.exit(tc, "getAllObjects", values); return values; }
java
public final synchronized Object[] getAllObjects() { if (tc.isEntryEnabled()) Tr.entry(tc, "getAllObjects"); Object[] values = _idMap.values(); if (tc.isEntryEnabled()) Tr.exit(tc, "getAllObjects", values); return values; }
[ "public", "final", "synchronized", "Object", "[", "]", "getAllObjects", "(", ")", "{", "if", "(", "tc", ".", "isEntryEnabled", "(", ")", ")", "Tr", ".", "entry", "(", "tc", ",", "\"getAllObjects\"", ")", ";", "Object", "[", "]", "values", "=", "_idMap", ".", "values", "(", ")", ";", "if", "(", "tc", ".", "isEntryEnabled", "(", ")", ")", "Tr", ".", "exit", "(", "tc", ",", "\"getAllObjects\"", ",", "values", ")", ";", "return", "values", ";", "}" ]
Return an array of all the objects currently held in the table. @return An array of all the objects in the table
[ "Return", "an", "array", "of", "all", "the", "objects", "currently", "held", "in", "the", "table", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.recoverylog/src/com/ibm/ws/recoverylog/utils/RecoverableUnitIdTable.java#L108-L117
train
OpenLiberty/open-liberty
dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/persistent/htod/HashtableOnDisk.java
HashtableOnDisk.getCacheKey
public synchronized Object getCacheKey(EvictionTableEntry evt) //3821 NK begin throws IOException, EOFException, FileManagerException, ClassNotFoundException, HashtableOnDiskException { Object key = null; if (filemgr == null) { throw new HashtableOnDiskException("No Filemanager"); } HashtableEntry e = findEntry(evt, RETRIEVE_KEY); //TODO: Do we need to increment read_hits and read_requests if (e != null) key = e.getKey(); return key; }
java
public synchronized Object getCacheKey(EvictionTableEntry evt) //3821 NK begin throws IOException, EOFException, FileManagerException, ClassNotFoundException, HashtableOnDiskException { Object key = null; if (filemgr == null) { throw new HashtableOnDiskException("No Filemanager"); } HashtableEntry e = findEntry(evt, RETRIEVE_KEY); //TODO: Do we need to increment read_hits and read_requests if (e != null) key = e.getKey(); return key; }
[ "public", "synchronized", "Object", "getCacheKey", "(", "EvictionTableEntry", "evt", ")", "//3821 NK begin", "throws", "IOException", ",", "EOFException", ",", "FileManagerException", ",", "ClassNotFoundException", ",", "HashtableOnDiskException", "{", "Object", "key", "=", "null", ";", "if", "(", "filemgr", "==", "null", ")", "{", "throw", "new", "HashtableOnDiskException", "(", "\"No Filemanager\"", ")", ";", "}", "HashtableEntry", "e", "=", "findEntry", "(", "evt", ",", "RETRIEVE_KEY", ")", ";", "//TODO: Do we need to increment read_hits and read_requests", "if", "(", "e", "!=", "null", ")", "key", "=", "e", ".", "getKey", "(", ")", ";", "return", "key", ";", "}" ]
This method is used by garbage collector to get the cache key for the corresponding EvictionTableEntry
[ "This", "method", "is", "used", "by", "garbage", "collector", "to", "get", "the", "cache", "key", "for", "the", "corresponding", "EvictionTableEntry" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/persistent/htod/HashtableOnDisk.java#L738-L754
train
OpenLiberty/open-liberty
dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/persistent/htod/HashtableOnDisk.java
HashtableOnDisk.remove
public synchronized boolean remove(Object key) throws IOException, EOFException, FileManagerException, ClassNotFoundException, HashtableOnDiskException { if (filemgr == null) { throw new HashtableOnDiskException("No Filemanager"); } if (key == null) return false; // no null keys allowed HashtableEntry e = findEntry(key, RETRIEVE_KEY, !CHECK_EXPIRED); if (e == null) return false; // not found boolean answer = remove(e); htoddc.returnToHashtableEntryPool(e); return answer; }
java
public synchronized boolean remove(Object key) throws IOException, EOFException, FileManagerException, ClassNotFoundException, HashtableOnDiskException { if (filemgr == null) { throw new HashtableOnDiskException("No Filemanager"); } if (key == null) return false; // no null keys allowed HashtableEntry e = findEntry(key, RETRIEVE_KEY, !CHECK_EXPIRED); if (e == null) return false; // not found boolean answer = remove(e); htoddc.returnToHashtableEntryPool(e); return answer; }
[ "public", "synchronized", "boolean", "remove", "(", "Object", "key", ")", "throws", "IOException", ",", "EOFException", ",", "FileManagerException", ",", "ClassNotFoundException", ",", "HashtableOnDiskException", "{", "if", "(", "filemgr", "==", "null", ")", "{", "throw", "new", "HashtableOnDiskException", "(", "\"No Filemanager\"", ")", ";", "}", "if", "(", "key", "==", "null", ")", "return", "false", ";", "// no null keys allowed", "HashtableEntry", "e", "=", "findEntry", "(", "key", ",", "RETRIEVE_KEY", ",", "!", "CHECK_EXPIRED", ")", ";", "if", "(", "e", "==", "null", ")", "return", "false", ";", "// not found", "boolean", "answer", "=", "remove", "(", "e", ")", ";", "htoddc", ".", "returnToHashtableEntryPool", "(", "e", ")", ";", "return", "answer", ";", "}" ]
Removes the mapping for this key and deletes the object from disk. @param key The key of the object being removed. @return true if successful, false otherwise @exception FileManagerException The underlying file manager has a problem. @exception ClassNotFoundException Some key in the hash bucket cannot be deserialized while searching to see if the object already exists. The underlying file is likely corrupted. @exception IOException The underlying file has a problem and is likely corrupt. @exception EOFxception We were asked to seek beyond the end of the file. The file is likely corrupt. @exception HashtableOnDiskException The hashtable header is readable but invalid. One or more of the following is true: the magic string is invalid, the header pointers are null, the header pointers do not point to a recognizable hashtable.
[ "Removes", "the", "mapping", "for", "this", "key", "and", "deletes", "the", "object", "from", "disk", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/persistent/htod/HashtableOnDisk.java#L1144-L1164
train
OpenLiberty/open-liberty
dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/persistent/htod/HashtableOnDisk.java
HashtableOnDisk.updateExpirationInHeader
public synchronized boolean updateExpirationInHeader(Object key, long expirationTime, long validatorExpirationTime) throws IOException, EOFException, FileManagerException, ClassNotFoundException, HashtableOnDiskException { if (filemgr == null) { throw new HashtableOnDiskException("No Filemanager"); } if (key == null) return false; // no null keys allowed HashtableEntry entry = findEntry(key, RETRIEVE_KEY, !CHECK_EXPIRED); if (entry == null) return false; // not found // // Seek to point to validator expiration time field in the header filemgr.seek(entry.location + DWORDSIZE + // room for next SWORDSIZE); // room for hash filemgr.writeLong(validatorExpirationTime); // update VET /* * comment out the code below because the expiration time does not change * filemgr.writeInt(0); * filemgr.writeInt(entry.cacheValueHashcode); // update cache value hashcode * filemgr.writeLong(entry.first_created); // update first created (not neccessary but move to pointer * filemgr.writeLong(expirationTime); // update RET */ htoddc.returnToHashtableEntryPool(entry); return true; }
java
public synchronized boolean updateExpirationInHeader(Object key, long expirationTime, long validatorExpirationTime) throws IOException, EOFException, FileManagerException, ClassNotFoundException, HashtableOnDiskException { if (filemgr == null) { throw new HashtableOnDiskException("No Filemanager"); } if (key == null) return false; // no null keys allowed HashtableEntry entry = findEntry(key, RETRIEVE_KEY, !CHECK_EXPIRED); if (entry == null) return false; // not found // // Seek to point to validator expiration time field in the header filemgr.seek(entry.location + DWORDSIZE + // room for next SWORDSIZE); // room for hash filemgr.writeLong(validatorExpirationTime); // update VET /* * comment out the code below because the expiration time does not change * filemgr.writeInt(0); * filemgr.writeInt(entry.cacheValueHashcode); // update cache value hashcode * filemgr.writeLong(entry.first_created); // update first created (not neccessary but move to pointer * filemgr.writeLong(expirationTime); // update RET */ htoddc.returnToHashtableEntryPool(entry); return true; }
[ "public", "synchronized", "boolean", "updateExpirationInHeader", "(", "Object", "key", ",", "long", "expirationTime", ",", "long", "validatorExpirationTime", ")", "throws", "IOException", ",", "EOFException", ",", "FileManagerException", ",", "ClassNotFoundException", ",", "HashtableOnDiskException", "{", "if", "(", "filemgr", "==", "null", ")", "{", "throw", "new", "HashtableOnDiskException", "(", "\"No Filemanager\"", ")", ";", "}", "if", "(", "key", "==", "null", ")", "return", "false", ";", "// no null keys allowed", "HashtableEntry", "entry", "=", "findEntry", "(", "key", ",", "RETRIEVE_KEY", ",", "!", "CHECK_EXPIRED", ")", ";", "if", "(", "entry", "==", "null", ")", "return", "false", ";", "// not found", "//", "// Seek to point to validator expiration time field in the header", "filemgr", ".", "seek", "(", "entry", ".", "location", "+", "DWORDSIZE", "+", "// room for next", "SWORDSIZE", ")", ";", "// room for hash", "filemgr", ".", "writeLong", "(", "validatorExpirationTime", ")", ";", "// update VET", "/*\n * comment out the code below because the expiration time does not change\n * filemgr.writeInt(0);\n * filemgr.writeInt(entry.cacheValueHashcode); // update cache value hashcode\n * filemgr.writeLong(entry.first_created); // update first created (not neccessary but move to pointer\n * filemgr.writeLong(expirationTime); // update RET\n */", "htoddc", ".", "returnToHashtableEntryPool", "(", "entry", ")", ";", "return", "true", ";", "}" ]
This method is used to update expiration times in disk entry header
[ "This", "method", "is", "used", "to", "update", "expiration", "times", "in", "disk", "entry", "header" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/persistent/htod/HashtableOnDisk.java#L1201-L1233
train
OpenLiberty/open-liberty
dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/persistent/htod/HashtableOnDisk.java
HashtableOnDisk.walkHash
int walkHash(HashtableAction action, int retrieveMode, int index, int length) throws IOException, EOFException, FileManagerException, ClassNotFoundException, HashtableOnDiskException { iterationLock.p(); int tindex = -1; int tableSize = header.tablesize(); //System.out.println("*** table size= " + tableSize + " index=" + index + " length=" + length); try { for (int i = index, j = 0; i < tableSize; i++) { // // We want to drop the lock between each iteration so that other // threads can continue to work // boolean result = true; synchronized (this) { long location = getHtindex(i, header.currentTableId()); long previous = 0; long next = 0; int hash = 0; initReadBuffer(location); next = headerin.readLong(); hash = headerin.readInt(); while (location != 0) { HashtableEntry e = readEntry2(location, next, hash, previous, retrieveMode, !CHECK_EXPIRED, header.currentTableId(), null, null); if (e != null) { j++; try { Object id = e.getKey(); result = action.execute(e); // if result is false, do not continue if (result == false) { // LI4337-17 traceDebug("walkHash()", "cacheName=" + this.htoddc.cacheName + " id=" + id + " action.execute() returns false."); break; } } catch (Exception xcp) { throw new HashtableOnDiskException("HashtableAction: " + xcp.toString()); } previous = location; location = next; if (location != 0) { initReadBuffer(location); next = headerin.readLong(); hash = headerin.readInt(); } } } // if result is false, do not continue if (result == false) { // LI4337-17 break; } if (j >= length) { tindex = i + 1; break; } } } } finally { iterationLock.v(); } if (tindex == -1) { tindex = tableSize; } //System.out.println("*** HTOD return index=" + tindex + " tableSize=" + tableSize); return tindex; }
java
int walkHash(HashtableAction action, int retrieveMode, int index, int length) throws IOException, EOFException, FileManagerException, ClassNotFoundException, HashtableOnDiskException { iterationLock.p(); int tindex = -1; int tableSize = header.tablesize(); //System.out.println("*** table size= " + tableSize + " index=" + index + " length=" + length); try { for (int i = index, j = 0; i < tableSize; i++) { // // We want to drop the lock between each iteration so that other // threads can continue to work // boolean result = true; synchronized (this) { long location = getHtindex(i, header.currentTableId()); long previous = 0; long next = 0; int hash = 0; initReadBuffer(location); next = headerin.readLong(); hash = headerin.readInt(); while (location != 0) { HashtableEntry e = readEntry2(location, next, hash, previous, retrieveMode, !CHECK_EXPIRED, header.currentTableId(), null, null); if (e != null) { j++; try { Object id = e.getKey(); result = action.execute(e); // if result is false, do not continue if (result == false) { // LI4337-17 traceDebug("walkHash()", "cacheName=" + this.htoddc.cacheName + " id=" + id + " action.execute() returns false."); break; } } catch (Exception xcp) { throw new HashtableOnDiskException("HashtableAction: " + xcp.toString()); } previous = location; location = next; if (location != 0) { initReadBuffer(location); next = headerin.readLong(); hash = headerin.readInt(); } } } // if result is false, do not continue if (result == false) { // LI4337-17 break; } if (j >= length) { tindex = i + 1; break; } } } } finally { iterationLock.v(); } if (tindex == -1) { tindex = tableSize; } //System.out.println("*** HTOD return index=" + tindex + " tableSize=" + tableSize); return tindex; }
[ "int", "walkHash", "(", "HashtableAction", "action", ",", "int", "retrieveMode", ",", "int", "index", ",", "int", "length", ")", "throws", "IOException", ",", "EOFException", ",", "FileManagerException", ",", "ClassNotFoundException", ",", "HashtableOnDiskException", "{", "iterationLock", ".", "p", "(", ")", ";", "int", "tindex", "=", "-", "1", ";", "int", "tableSize", "=", "header", ".", "tablesize", "(", ")", ";", "//System.out.println(\"*** table size= \" + tableSize + \" index=\" + index + \" length=\" + length);", "try", "{", "for", "(", "int", "i", "=", "index", ",", "j", "=", "0", ";", "i", "<", "tableSize", ";", "i", "++", ")", "{", "//", "// We want to drop the lock between each iteration so that other", "// threads can continue to work", "//", "boolean", "result", "=", "true", ";", "synchronized", "(", "this", ")", "{", "long", "location", "=", "getHtindex", "(", "i", ",", "header", ".", "currentTableId", "(", ")", ")", ";", "long", "previous", "=", "0", ";", "long", "next", "=", "0", ";", "int", "hash", "=", "0", ";", "initReadBuffer", "(", "location", ")", ";", "next", "=", "headerin", ".", "readLong", "(", ")", ";", "hash", "=", "headerin", ".", "readInt", "(", ")", ";", "while", "(", "location", "!=", "0", ")", "{", "HashtableEntry", "e", "=", "readEntry2", "(", "location", ",", "next", ",", "hash", ",", "previous", ",", "retrieveMode", ",", "!", "CHECK_EXPIRED", ",", "header", ".", "currentTableId", "(", ")", ",", "null", ",", "null", ")", ";", "if", "(", "e", "!=", "null", ")", "{", "j", "++", ";", "try", "{", "Object", "id", "=", "e", ".", "getKey", "(", ")", ";", "result", "=", "action", ".", "execute", "(", "e", ")", ";", "// if result is false, do not continue", "if", "(", "result", "==", "false", ")", "{", "// LI4337-17", "traceDebug", "(", "\"walkHash()\"", ",", "\"cacheName=\"", "+", "this", ".", "htoddc", ".", "cacheName", "+", "\" id=\"", "+", "id", "+", "\" action.execute() returns false.\"", ")", ";", "break", ";", "}", "}", "catch", "(", "Exception", "xcp", ")", "{", "throw", "new", "HashtableOnDiskException", "(", "\"HashtableAction: \"", "+", "xcp", ".", "toString", "(", ")", ")", ";", "}", "previous", "=", "location", ";", "location", "=", "next", ";", "if", "(", "location", "!=", "0", ")", "{", "initReadBuffer", "(", "location", ")", ";", "next", "=", "headerin", ".", "readLong", "(", ")", ";", "hash", "=", "headerin", ".", "readInt", "(", ")", ";", "}", "}", "}", "// if result is false, do not continue", "if", "(", "result", "==", "false", ")", "{", "// LI4337-17", "break", ";", "}", "if", "(", "j", ">=", "length", ")", "{", "tindex", "=", "i", "+", "1", ";", "break", ";", "}", "}", "}", "}", "finally", "{", "iterationLock", ".", "v", "(", ")", ";", "}", "if", "(", "tindex", "==", "-", "1", ")", "{", "tindex", "=", "tableSize", ";", "}", "//System.out.println(\"*** HTOD return index=\" + tindex + \" tableSize=\" + tableSize);", "return", "tindex", ";", "}" ]
Generic routine to walk the hash table and pass each entry to the "action" interface.
[ "Generic", "routine", "to", "walk", "the", "hash", "table", "and", "pass", "each", "entry", "to", "the", "action", "interface", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/persistent/htod/HashtableOnDisk.java#L2250-L2321
train
OpenLiberty/open-liberty
dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/persistent/htod/HashtableOnDisk.java
HashtableOnDisk.listfiles
public void listfiles(Writer o) throws IOException, EOFException, FileManagerException, ClassNotFoundException, HashtableOnDiskException { ListAction act = new ListAction(o); walkHash(act, RETRIEVE_KEY, 0, -1); }
java
public void listfiles(Writer o) throws IOException, EOFException, FileManagerException, ClassNotFoundException, HashtableOnDiskException { ListAction act = new ListAction(o); walkHash(act, RETRIEVE_KEY, 0, -1); }
[ "public", "void", "listfiles", "(", "Writer", "o", ")", "throws", "IOException", ",", "EOFException", ",", "FileManagerException", ",", "ClassNotFoundException", ",", "HashtableOnDiskException", "{", "ListAction", "act", "=", "new", "ListAction", "(", "o", ")", ";", "walkHash", "(", "act", ",", "RETRIEVE_KEY", ",", "0", ",", "-", "1", ")", ";", "}" ]
Dump all keys to stdout.
[ "Dump", "all", "keys", "to", "stdout", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/persistent/htod/HashtableOnDisk.java#L2355-L2363
train
OpenLiberty/open-liberty
dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/persistent/htod/HashtableOnDisk.java
HashtableOnDisk.countAndVerifyObjects
private void countAndVerifyObjects() throws IOException, EOFException, FileManagerException, ClassNotFoundException, HashtableOnDiskException { println("countAndVerifyObjects(): Hashtable " + filename + " was not closed properly. Validating "); header.set_num_objects(0); HashtableAction act = new HashtableAction() { public boolean execute(HashtableEntry e) throws IOException { if ((header.num_objects() % 100) == 0) { print("."); } header.incrementObjectCount(); if (item_initialize != null) { item_initialize.initialize(e.getKey(), e.getValue()); } return true; } }; walkHash(act, RETRIEVE_ALL, 0, -1); header.write(); println("countAndVerifyObjects(): done"); }
java
private void countAndVerifyObjects() throws IOException, EOFException, FileManagerException, ClassNotFoundException, HashtableOnDiskException { println("countAndVerifyObjects(): Hashtable " + filename + " was not closed properly. Validating "); header.set_num_objects(0); HashtableAction act = new HashtableAction() { public boolean execute(HashtableEntry e) throws IOException { if ((header.num_objects() % 100) == 0) { print("."); } header.incrementObjectCount(); if (item_initialize != null) { item_initialize.initialize(e.getKey(), e.getValue()); } return true; } }; walkHash(act, RETRIEVE_ALL, 0, -1); header.write(); println("countAndVerifyObjects(): done"); }
[ "private", "void", "countAndVerifyObjects", "(", ")", "throws", "IOException", ",", "EOFException", ",", "FileManagerException", ",", "ClassNotFoundException", ",", "HashtableOnDiskException", "{", "println", "(", "\"countAndVerifyObjects(): Hashtable \"", "+", "filename", "+", "\" was not closed properly. Validating \"", ")", ";", "header", ".", "set_num_objects", "(", "0", ")", ";", "HashtableAction", "act", "=", "new", "HashtableAction", "(", ")", "{", "public", "boolean", "execute", "(", "HashtableEntry", "e", ")", "throws", "IOException", "{", "if", "(", "(", "header", ".", "num_objects", "(", ")", "%", "100", ")", "==", "0", ")", "{", "print", "(", "\".\"", ")", ";", "}", "header", ".", "incrementObjectCount", "(", ")", ";", "if", "(", "item_initialize", "!=", "null", ")", "{", "item_initialize", ".", "initialize", "(", "e", ".", "getKey", "(", ")", ",", "e", ".", "getValue", "(", ")", ")", ";", "}", "return", "true", ";", "}", "}", ";", "walkHash", "(", "act", ",", "RETRIEVE_ALL", ",", "0", ",", "-", "1", ")", ";", "header", ".", "write", "(", ")", ";", "println", "(", "\"countAndVerifyObjects(): done\"", ")", ";", "}" ]
This walks the hash table and sets the internal count of objects. Note that it also sort of works as a verifier of the content - if we throw an exception we can be sure the file is corrupted.
[ "This", "walks", "the", "hash", "table", "and", "sets", "the", "internal", "count", "of", "objects", ".", "Note", "that", "it", "also", "sort", "of", "works", "as", "a", "verifier", "of", "the", "content", "-", "if", "we", "throw", "an", "exception", "we", "can", "be", "sure", "the", "file", "is", "corrupted", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/persistent/htod/HashtableOnDisk.java#L2653-L2681
train
OpenLiberty/open-liberty
dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/persistent/htod/HashtableOnDisk.java
HashtableOnDisk.countObjects
private void countObjects() throws IOException, EOFException, FileManagerException, ClassNotFoundException, HashtableOnDiskException { println("countObjects(): Hashtable " + filename + " was not closed properly. Validating "); iterationLock.p(); int count = 0; try { for (int i = 0; i < header.tablesize(); i++) { // // We want to drop the lock between each iteration so that other // threads can continue to work // long next = getHtindex(i, header.currentTableId());// jrc 04/30/02 use cached entry while (next != 0) { count++; if ((count % 100) == 0) { if (debug) print("."); } filemgr.seek(next); next = filemgr.readLong(); } } header.set_num_objects(count); header.write(); } finally { iterationLock.v(); } println("countObjects(): done[" + count + "]"); }
java
private void countObjects() throws IOException, EOFException, FileManagerException, ClassNotFoundException, HashtableOnDiskException { println("countObjects(): Hashtable " + filename + " was not closed properly. Validating "); iterationLock.p(); int count = 0; try { for (int i = 0; i < header.tablesize(); i++) { // // We want to drop the lock between each iteration so that other // threads can continue to work // long next = getHtindex(i, header.currentTableId());// jrc 04/30/02 use cached entry while (next != 0) { count++; if ((count % 100) == 0) { if (debug) print("."); } filemgr.seek(next); next = filemgr.readLong(); } } header.set_num_objects(count); header.write(); } finally { iterationLock.v(); } println("countObjects(): done[" + count + "]"); }
[ "private", "void", "countObjects", "(", ")", "throws", "IOException", ",", "EOFException", ",", "FileManagerException", ",", "ClassNotFoundException", ",", "HashtableOnDiskException", "{", "println", "(", "\"countObjects(): Hashtable \"", "+", "filename", "+", "\" was not closed properly. Validating \"", ")", ";", "iterationLock", ".", "p", "(", ")", ";", "int", "count", "=", "0", ";", "try", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "header", ".", "tablesize", "(", ")", ";", "i", "++", ")", "{", "//", "// We want to drop the lock between each iteration so that other", "// threads can continue to work", "//", "long", "next", "=", "getHtindex", "(", "i", ",", "header", ".", "currentTableId", "(", ")", ")", ";", "// jrc 04/30/02 use cached entry", "while", "(", "next", "!=", "0", ")", "{", "count", "++", ";", "if", "(", "(", "count", "%", "100", ")", "==", "0", ")", "{", "if", "(", "debug", ")", "print", "(", "\".\"", ")", ";", "}", "filemgr", ".", "seek", "(", "next", ")", ";", "next", "=", "filemgr", ".", "readLong", "(", ")", ";", "}", "}", "header", ".", "set_num_objects", "(", "count", ")", ";", "header", ".", "write", "(", ")", ";", "}", "finally", "{", "iterationLock", ".", "v", "(", ")", ";", "}", "println", "(", "\"countObjects(): done[\"", "+", "count", "+", "\"]\"", ")", ";", "}" ]
This walks the hash table and sets the internal count of objects. It is streamlined to only get a count and not examine any objects.
[ "This", "walks", "the", "hash", "table", "and", "sets", "the", "internal", "count", "of", "objects", ".", "It", "is", "streamlined", "to", "only", "get", "a", "count", "and", "not", "examine", "any", "objects", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/persistent/htod/HashtableOnDisk.java#L2687-L2725
train
OpenLiberty/open-liberty
dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/persistent/htod/HashtableOnDisk.java
HashtableOnDisk.rehash
private void rehash() throws IOException, EOFException, FileManagerException, ClassNotFoundException, HashtableOnDiskException { int size = (header.tablesize() * 2) + 1; if (this.tempTableSize > size) { doRehash(this.tempTableSize); this.tempTableSize = 0; } else { doRehash(size); } }
java
private void rehash() throws IOException, EOFException, FileManagerException, ClassNotFoundException, HashtableOnDiskException { int size = (header.tablesize() * 2) + 1; if (this.tempTableSize > size) { doRehash(this.tempTableSize); this.tempTableSize = 0; } else { doRehash(size); } }
[ "private", "void", "rehash", "(", ")", "throws", "IOException", ",", "EOFException", ",", "FileManagerException", ",", "ClassNotFoundException", ",", "HashtableOnDiskException", "{", "int", "size", "=", "(", "header", ".", "tablesize", "(", ")", "*", "2", ")", "+", "1", ";", "if", "(", "this", ".", "tempTableSize", ">", "size", ")", "{", "doRehash", "(", "this", ".", "tempTableSize", ")", ";", "this", ".", "tempTableSize", "=", "0", ";", "}", "else", "{", "doRehash", "(", "size", ")", ";", "}", "}" ]
Internal method to do default rehash of doubling
[ "Internal", "method", "to", "do", "default", "rehash", "of", "doubling" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/persistent/htod/HashtableOnDisk.java#L2730-L2743
train
OpenLiberty/open-liberty
dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/persistent/htod/HashtableOnDisk.java
HashtableOnDisk.doRehash
private void doRehash(int new_table_size) throws IOException, EOFException, FileManagerException, ClassNotFoundException, HashtableOnDiskException { // // Acquire the lock to prevent iteration while doubling // iterationLock.p(); // // Step 0: // This should be our only exposure = for a short time we // will have allocated the new table but not stored its location // anywhere. If we crash here we leak that storage permanently. // long new_table = 0; header.setRehashFlag(1); new_table = filemgr.allocateAndClear(new_table_size * DWORDSIZE); header.initNewTable(new_table_size, new_table); PrimitiveArrayPool.PoolEntry longPoolEntry = this.htoddc.longArrayPool.allocate(new_table_size); new_htindex = (long[]) longPoolEntry.getArray(); //new_htindex = new long[new_table_size]; Rehash rehash = new Rehash(this, new_table, new_table_size); Thread t = new Thread(rehash); t.start(); }
java
private void doRehash(int new_table_size) throws IOException, EOFException, FileManagerException, ClassNotFoundException, HashtableOnDiskException { // // Acquire the lock to prevent iteration while doubling // iterationLock.p(); // // Step 0: // This should be our only exposure = for a short time we // will have allocated the new table but not stored its location // anywhere. If we crash here we leak that storage permanently. // long new_table = 0; header.setRehashFlag(1); new_table = filemgr.allocateAndClear(new_table_size * DWORDSIZE); header.initNewTable(new_table_size, new_table); PrimitiveArrayPool.PoolEntry longPoolEntry = this.htoddc.longArrayPool.allocate(new_table_size); new_htindex = (long[]) longPoolEntry.getArray(); //new_htindex = new long[new_table_size]; Rehash rehash = new Rehash(this, new_table, new_table_size); Thread t = new Thread(rehash); t.start(); }
[ "private", "void", "doRehash", "(", "int", "new_table_size", ")", "throws", "IOException", ",", "EOFException", ",", "FileManagerException", ",", "ClassNotFoundException", ",", "HashtableOnDiskException", "{", "//", "// Acquire the lock to prevent iteration while doubling", "//", "iterationLock", ".", "p", "(", ")", ";", "//", "// Step 0:", "// This should be our only exposure = for a short time we", "// will have allocated the new table but not stored its location", "// anywhere. If we crash here we leak that storage permanently.", "// ", "long", "new_table", "=", "0", ";", "header", ".", "setRehashFlag", "(", "1", ")", ";", "new_table", "=", "filemgr", ".", "allocateAndClear", "(", "new_table_size", "*", "DWORDSIZE", ")", ";", "header", ".", "initNewTable", "(", "new_table_size", ",", "new_table", ")", ";", "PrimitiveArrayPool", ".", "PoolEntry", "longPoolEntry", "=", "this", ".", "htoddc", ".", "longArrayPool", ".", "allocate", "(", "new_table_size", ")", ";", "new_htindex", "=", "(", "long", "[", "]", ")", "longPoolEntry", ".", "getArray", "(", ")", ";", "//new_htindex = new long[new_table_size]; ", "Rehash", "rehash", "=", "new", "Rehash", "(", "this", ",", "new_table", ",", "new_table_size", ")", ";", "Thread", "t", "=", "new", "Thread", "(", "rehash", ")", ";", "t", ".", "start", "(", ")", ";", "}" ]
Double the size of the hash table - The variable rehashInProgress is set to non-0 on disk to indicate that rehashing is in progress. We use rehashInProgress to temporarily hold the hash bucket in the new table while chaining the old one in. So rehashInProgress is either 0 (rehash done), 1 (rehash in progress), or something else (rehash in progress, points to hash bucket in new table). The algorithm is this: 1. Allocate a new hashtable and set rehashInProgress to 1. 2. For each entry in the old table (OT), calculate its new hash in the new table. If the bucket is not empty, save its value in the rehashInProgress pointer. Now place the pointer to the entry in the new table. If the entry has a "next" entry. 3. Set the bucket pointer in OT to point to it. 4. Set the "next" pointer in the entry to the saved value from 2. 5. Set rehashInProgress to 1.
[ "Double", "the", "size", "of", "the", "hash", "table", "-" ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/persistent/htod/HashtableOnDisk.java#L2768-L2799
train
OpenLiberty/open-liberty
dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/persistent/htod/HashtableOnDisk.java
HashHeader.setRehashFlag
void setRehashFlag(long location) throws IOException, EOFException { rehashInProgress = location; filemgr.seek(rehashOffset); filemgr.writeLong(location); }
java
void setRehashFlag(long location) throws IOException, EOFException { rehashInProgress = location; filemgr.seek(rehashOffset); filemgr.writeLong(location); }
[ "void", "setRehashFlag", "(", "long", "location", ")", "throws", "IOException", ",", "EOFException", "{", "rehashInProgress", "=", "location", ";", "filemgr", ".", "seek", "(", "rehashOffset", ")", ";", "filemgr", ".", "writeLong", "(", "location", ")", ";", "}" ]
Set the rehash indicator. If set during startup we must initiate recovery and complete the rehash.
[ "Set", "the", "rehash", "indicator", ".", "If", "set", "during", "startup", "we", "must", "initiate", "recovery", "and", "complete", "the", "rehash", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/persistent/htod/HashtableOnDisk.java#L3480-L3486
train
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/jfapchannel/impl/ConversationTable.java
ConversationTable.contains
public synchronized boolean contains(int id) { if (tc.isEntryEnabled()) SibTr.entry(this, tc, "contains", ""+id); mutableKey.setValue(id); boolean returnValue = idToConvTable.containsKey(mutableKey); if (tc.isEntryEnabled()) SibTr.exit(this, tc, "contains", ""+returnValue); return returnValue; }
java
public synchronized boolean contains(int id) { if (tc.isEntryEnabled()) SibTr.entry(this, tc, "contains", ""+id); mutableKey.setValue(id); boolean returnValue = idToConvTable.containsKey(mutableKey); if (tc.isEntryEnabled()) SibTr.exit(this, tc, "contains", ""+returnValue); return returnValue; }
[ "public", "synchronized", "boolean", "contains", "(", "int", "id", ")", "{", "if", "(", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "entry", "(", "this", ",", "tc", ",", "\"contains\"", ",", "\"\"", "+", "id", ")", ";", "mutableKey", ".", "setValue", "(", "id", ")", ";", "boolean", "returnValue", "=", "idToConvTable", ".", "containsKey", "(", "mutableKey", ")", ";", "if", "(", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "exit", "(", "this", ",", "tc", ",", "\"contains\"", ",", "\"\"", "+", "returnValue", ")", ";", "return", "returnValue", ";", "}" ]
Test to determine if a particular conversation ID is present in the table. @param id @return boolean
[ "Test", "to", "determine", "if", "a", "particular", "conversation", "ID", "is", "present", "in", "the", "table", "." ]
ca725d9903e63645018f9fa8cbda25f60af83a5d
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/jfapchannel/impl/ConversationTable.java#L127-L134
train