id
int32
0
165k
repo
stringlengths
7
58
path
stringlengths
12
218
func_name
stringlengths
3
140
original_string
stringlengths
73
34.1k
language
stringclasses
1 value
code
stringlengths
73
34.1k
code_tokens
list
docstring
stringlengths
3
16k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
105
339
52,100
belaban/JGroups
src/org/jgroups/util/RingBuffer.java
RingBuffer.waitForMessages
public int waitForMessages(int num_spins, final BiConsumer<Integer,Integer> wait_strategy) throws InterruptedException { // try spinning first (experimental) for(int i=0; i < num_spins && count == 0; i++) { if(wait_strategy != null) wait_strategy.accept(i, num_spins); ...
java
public int waitForMessages(int num_spins, final BiConsumer<Integer,Integer> wait_strategy) throws InterruptedException { // try spinning first (experimental) for(int i=0; i < num_spins && count == 0; i++) { if(wait_strategy != null) wait_strategy.accept(i, num_spins); ...
[ "public", "int", "waitForMessages", "(", "int", "num_spins", ",", "final", "BiConsumer", "<", "Integer", ",", "Integer", ">", "wait_strategy", ")", "throws", "InterruptedException", "{", "// try spinning first (experimental)", "for", "(", "int", "i", "=", "0", ";"...
Blocks until messages are available @param num_spins the number of times we should spin before acquiring a lock @param wait_strategy the strategy used to spin. The first parameter is the iteration count and the second parameter is the max number of spins
[ "Blocks", "until", "messages", "are", "available" ]
bd3ca786aa57fed41dfbc10a94b1281e388be03b
https://github.com/belaban/JGroups/blob/bd3ca786aa57fed41dfbc10a94b1281e388be03b/src/org/jgroups/util/RingBuffer.java#L274-L285
52,101
belaban/JGroups
src/org/jgroups/nio/Buffers.java
Buffers.readLengthAndData
public ByteBuffer readLengthAndData(SocketChannel ch) throws Exception { if(bufs[0].hasRemaining() && ch.read(bufs[0]) < 0) throw new EOFException(); if(bufs[0].hasRemaining()) return null; int len=bufs[0].getInt(0); if(bufs[1] == null || len > bufs[1].capacity(...
java
public ByteBuffer readLengthAndData(SocketChannel ch) throws Exception { if(bufs[0].hasRemaining() && ch.read(bufs[0]) < 0) throw new EOFException(); if(bufs[0].hasRemaining()) return null; int len=bufs[0].getInt(0); if(bufs[1] == null || len > bufs[1].capacity(...
[ "public", "ByteBuffer", "readLengthAndData", "(", "SocketChannel", "ch", ")", "throws", "Exception", "{", "if", "(", "bufs", "[", "0", "]", ".", "hasRemaining", "(", ")", "&&", "ch", ".", "read", "(", "bufs", "[", "0", "]", ")", "<", "0", ")", "throw...
Reads length and then length bytes into the data buffer, which is grown if needed. @param ch The channel to read data from @return The data buffer (position is 0 and limit is length), or null if not all data could be read.
[ "Reads", "length", "and", "then", "length", "bytes", "into", "the", "data", "buffer", "which", "is", "grown", "if", "needed", "." ]
bd3ca786aa57fed41dfbc10a94b1281e388be03b
https://github.com/belaban/JGroups/blob/bd3ca786aa57fed41dfbc10a94b1281e388be03b/src/org/jgroups/nio/Buffers.java#L123-L148
52,102
belaban/JGroups
src/org/jgroups/nio/Buffers.java
Buffers.copy
public Buffers copy() { for(int i=Math.max(position, next_to_copy); i < limit; i++) { this.bufs[i]=copyBuffer(this.bufs[i]); next_to_copy=(short)(i+1); } return this; }
java
public Buffers copy() { for(int i=Math.max(position, next_to_copy); i < limit; i++) { this.bufs[i]=copyBuffer(this.bufs[i]); next_to_copy=(short)(i+1); } return this; }
[ "public", "Buffers", "copy", "(", ")", "{", "for", "(", "int", "i", "=", "Math", ".", "max", "(", "position", ",", "next_to_copy", ")", ";", "i", "<", "limit", ";", "i", "++", ")", "{", "this", ".", "bufs", "[", "i", "]", "=", "copyBuffer", "("...
Copies the data that has not yet been written and moves last_copied. Typically done after an unsuccessful write, if copying is required. This is typically needed if the output buffer is reused. Note that direct buffers will be converted to heap-based buffers
[ "Copies", "the", "data", "that", "has", "not", "yet", "been", "written", "and", "moves", "last_copied", ".", "Typically", "done", "after", "an", "unsuccessful", "write", "if", "copying", "is", "required", ".", "This", "is", "typically", "needed", "if", "the"...
bd3ca786aa57fed41dfbc10a94b1281e388be03b
https://github.com/belaban/JGroups/blob/bd3ca786aa57fed41dfbc10a94b1281e388be03b/src/org/jgroups/nio/Buffers.java#L198-L204
52,103
belaban/JGroups
src/org/jgroups/nio/Buffers.java
Buffers.copyBuffer
public static ByteBuffer copyBuffer(final ByteBuffer buf) { if(buf == null) return null; int offset=buf.hasArray()? buf.arrayOffset() + buf.position() : buf.position(), len=buf.remaining(); byte[] tmp=new byte[len]; if(!buf.isDirect()) System.arraycopy(buf.array()...
java
public static ByteBuffer copyBuffer(final ByteBuffer buf) { if(buf == null) return null; int offset=buf.hasArray()? buf.arrayOffset() + buf.position() : buf.position(), len=buf.remaining(); byte[] tmp=new byte[len]; if(!buf.isDirect()) System.arraycopy(buf.array()...
[ "public", "static", "ByteBuffer", "copyBuffer", "(", "final", "ByteBuffer", "buf", ")", "{", "if", "(", "buf", "==", "null", ")", "return", "null", ";", "int", "offset", "=", "buf", ".", "hasArray", "(", ")", "?", "buf", ".", "arrayOffset", "(", ")", ...
Copies a ByteBuffer by copying and wrapping the underlying array of a heap-based buffer. Direct buffers are converted to heap-based buffers
[ "Copies", "a", "ByteBuffer", "by", "copying", "and", "wrapping", "the", "underlying", "array", "of", "a", "heap", "-", "based", "buffer", ".", "Direct", "buffers", "are", "converted", "to", "heap", "-", "based", "buffers" ]
bd3ca786aa57fed41dfbc10a94b1281e388be03b
https://github.com/belaban/JGroups/blob/bd3ca786aa57fed41dfbc10a94b1281e388be03b/src/org/jgroups/nio/Buffers.java#L287-L300
52,104
belaban/JGroups
src/org/jgroups/protocols/BaseBundler.java
BaseBundler.sendBundledMessages
@GuardedBy("lock") protected void sendBundledMessages() { for(Map.Entry<Address,List<Message>> entry: msgs.entrySet()) { List<Message> list=entry.getValue(); if(list.isEmpty()) continue; output.position(0); if(list.size() == 1) sen...
java
@GuardedBy("lock") protected void sendBundledMessages() { for(Map.Entry<Address,List<Message>> entry: msgs.entrySet()) { List<Message> list=entry.getValue(); if(list.isEmpty()) continue; output.position(0); if(list.size() == 1) sen...
[ "@", "GuardedBy", "(", "\"lock\"", ")", "protected", "void", "sendBundledMessages", "(", ")", "{", "for", "(", "Map", ".", "Entry", "<", "Address", ",", "List", "<", "Message", ">", ">", "entry", ":", "msgs", ".", "entrySet", "(", ")", ")", "{", "Lis...
Sends all messages in the map. Messages for the same destination are bundled into a message list. The map will be cleared when done.
[ "Sends", "all", "messages", "in", "the", "map", ".", "Messages", "for", "the", "same", "destination", "are", "bundled", "into", "a", "message", "list", ".", "The", "map", "will", "be", "cleared", "when", "done", "." ]
bd3ca786aa57fed41dfbc10a94b1281e388be03b
https://github.com/belaban/JGroups/blob/bd3ca786aa57fed41dfbc10a94b1281e388be03b/src/org/jgroups/protocols/BaseBundler.java#L60-L78
52,105
belaban/JGroups
src/org/jgroups/blocks/ReplCache.java
ReplCache.get
@ManagedOperation public V get(K key) { // 1. Try the L1 cache first if(l1_cache != null) { V val=l1_cache.get(key); if(val != null) { if(log.isTraceEnabled()) log.trace("returned value " + val + " for " + key + " from L1 cache"); ...
java
@ManagedOperation public V get(K key) { // 1. Try the L1 cache first if(l1_cache != null) { V val=l1_cache.get(key); if(val != null) { if(log.isTraceEnabled()) log.trace("returned value " + val + " for " + key + " from L1 cache"); ...
[ "@", "ManagedOperation", "public", "V", "get", "(", "K", "key", ")", "{", "// 1. Try the L1 cache first", "if", "(", "l1_cache", "!=", "null", ")", "{", "V", "val", "=", "l1_cache", ".", "get", "(", "key", ")", ";", "if", "(", "val", "!=", "null", ")...
Returns the value associated with key @param key The key, has to be serializable @return The value associated with key, or null
[ "Returns", "the", "value", "associated", "with", "key" ]
bd3ca786aa57fed41dfbc10a94b1281e388be03b
https://github.com/belaban/JGroups/blob/bd3ca786aa57fed41dfbc10a94b1281e388be03b/src/org/jgroups/blocks/ReplCache.java#L385-L438
52,106
belaban/JGroups
src/org/jgroups/blocks/ReplCache.java
ReplCache.remove
@ManagedOperation public void remove(K key, boolean synchronous) { try { disp.callRemoteMethods(null, new MethodCall(REMOVE, key), new RequestOptions(synchronous? ResponseMode.GET_ALL : ResponseMode.GET_NONE, call_timeout)); if(l1_cache != null) ...
java
@ManagedOperation public void remove(K key, boolean synchronous) { try { disp.callRemoteMethods(null, new MethodCall(REMOVE, key), new RequestOptions(synchronous? ResponseMode.GET_ALL : ResponseMode.GET_NONE, call_timeout)); if(l1_cache != null) ...
[ "@", "ManagedOperation", "public", "void", "remove", "(", "K", "key", ",", "boolean", "synchronous", ")", "{", "try", "{", "disp", ".", "callRemoteMethods", "(", "null", ",", "new", "MethodCall", "(", "REMOVE", ",", "key", ")", ",", "new", "RequestOptions"...
Removes key in all nodes in the cluster, both from their local hashmaps and L1 caches @param key The key, needs to be serializable
[ "Removes", "key", "in", "all", "nodes", "in", "the", "cluster", "both", "from", "their", "local", "hashmaps", "and", "L1", "caches" ]
bd3ca786aa57fed41dfbc10a94b1281e388be03b
https://github.com/belaban/JGroups/blob/bd3ca786aa57fed41dfbc10a94b1281e388be03b/src/org/jgroups/blocks/ReplCache.java#L454-L466
52,107
belaban/JGroups
src/org/jgroups/blocks/ReplCache.java
ReplCache.clear
@ManagedOperation public void clear() { Set<K> keys=new HashSet<>(l2_cache.getInternalMap().keySet()); mcastClear(keys, false); }
java
@ManagedOperation public void clear() { Set<K> keys=new HashSet<>(l2_cache.getInternalMap().keySet()); mcastClear(keys, false); }
[ "@", "ManagedOperation", "public", "void", "clear", "(", ")", "{", "Set", "<", "K", ">", "keys", "=", "new", "HashSet", "<>", "(", "l2_cache", ".", "getInternalMap", "(", ")", ".", "keySet", "(", ")", ")", ";", "mcastClear", "(", "keys", ",", "false"...
Removes all keys and values in the L2 and L1 caches
[ "Removes", "all", "keys", "and", "values", "in", "the", "L2", "and", "L1", "caches" ]
bd3ca786aa57fed41dfbc10a94b1281e388be03b
https://github.com/belaban/JGroups/blob/bd3ca786aa57fed41dfbc10a94b1281e388be03b/src/org/jgroups/blocks/ReplCache.java#L472-L476
52,108
belaban/JGroups
src/org/jgroups/protocols/pbcast/ClientGmsImpl.java
ClientGmsImpl.installViewIfValidJoinRsp
protected boolean installViewIfValidJoinRsp(final Promise<JoinRsp> join_promise, boolean block_for_rsp) { boolean success=false; JoinRsp rsp=null; try { if(join_promise.hasResult()) rsp=join_promise.getResult(1, true); else if(block_for_rsp) ...
java
protected boolean installViewIfValidJoinRsp(final Promise<JoinRsp> join_promise, boolean block_for_rsp) { boolean success=false; JoinRsp rsp=null; try { if(join_promise.hasResult()) rsp=join_promise.getResult(1, true); else if(block_for_rsp) ...
[ "protected", "boolean", "installViewIfValidJoinRsp", "(", "final", "Promise", "<", "JoinRsp", ">", "join_promise", ",", "boolean", "block_for_rsp", ")", "{", "boolean", "success", "=", "false", ";", "JoinRsp", "rsp", "=", "null", ";", "try", "{", "if", "(", ...
go through discovery and JOIN-REQ again in a next iteration
[ "go", "through", "discovery", "and", "JOIN", "-", "REQ", "again", "in", "a", "next", "iteration" ]
bd3ca786aa57fed41dfbc10a94b1281e388be03b
https://github.com/belaban/JGroups/blob/bd3ca786aa57fed41dfbc10a94b1281e388be03b/src/org/jgroups/protocols/pbcast/ClientGmsImpl.java#L138-L153
52,109
belaban/JGroups
src/org/jgroups/protocols/pbcast/ClientGmsImpl.java
ClientGmsImpl.getCoords
private static List<Address> getCoords(Iterable<PingData> mbrs) { if(mbrs == null) return null; List<Address> coords=null; for(PingData mbr: mbrs) { if(mbr.isCoord()) { if(coords == null) coords=new ArrayList<>(); if(!c...
java
private static List<Address> getCoords(Iterable<PingData> mbrs) { if(mbrs == null) return null; List<Address> coords=null; for(PingData mbr: mbrs) { if(mbr.isCoord()) { if(coords == null) coords=new ArrayList<>(); if(!c...
[ "private", "static", "List", "<", "Address", ">", "getCoords", "(", "Iterable", "<", "PingData", ">", "mbrs", ")", "{", "if", "(", "mbrs", "==", "null", ")", "return", "null", ";", "List", "<", "Address", ">", "coords", "=", "null", ";", "for", "(", ...
Returns all members whose PingData is flagged as coordinator
[ "Returns", "all", "members", "whose", "PingData", "is", "flagged", "as", "coordinator" ]
bd3ca786aa57fed41dfbc10a94b1281e388be03b
https://github.com/belaban/JGroups/blob/bd3ca786aa57fed41dfbc10a94b1281e388be03b/src/org/jgroups/protocols/pbcast/ClientGmsImpl.java#L229-L243
52,110
belaban/JGroups
src/org/jgroups/stack/Configurator.java
Configurator.createProtocol
public static Protocol createProtocol(String prot_spec, ProtocolStack stack) throws Exception { ProtocolConfiguration config; Protocol prot; if(prot_spec == null) throw new Exception("Configurator.createProtocol(): prot_spec is null"); // parse the configuration for this protocol ...
java
public static Protocol createProtocol(String prot_spec, ProtocolStack stack) throws Exception { ProtocolConfiguration config; Protocol prot; if(prot_spec == null) throw new Exception("Configurator.createProtocol(): prot_spec is null"); // parse the configuration for this protocol ...
[ "public", "static", "Protocol", "createProtocol", "(", "String", "prot_spec", ",", "ProtocolStack", "stack", ")", "throws", "Exception", "{", "ProtocolConfiguration", "config", ";", "Protocol", "prot", ";", "if", "(", "prot_spec", "==", "null", ")", "throw", "ne...
Creates a new protocol given the protocol specification. Initializes the properties and starts the up and down handler threads. @param prot_spec The specification of the protocol. Same convention as for specifying a protocol stack. An exception will be thrown if the class cannot be created. Example: <pre>"VERIFY_SUSPEC...
[ "Creates", "a", "new", "protocol", "given", "the", "protocol", "specification", ".", "Initializes", "the", "properties", "and", "starts", "the", "up", "and", "down", "handler", "threads", "." ]
bd3ca786aa57fed41dfbc10a94b1281e388be03b
https://github.com/belaban/JGroups/blob/bd3ca786aa57fed41dfbc10a94b1281e388be03b/src/org/jgroups/stack/Configurator.java#L155-L168
52,111
belaban/JGroups
src/org/jgroups/stack/Configurator.java
Configurator.connectProtocols
public static Protocol connectProtocols(List<Protocol> protocol_list) throws Exception { Protocol current_layer=null, next_layer=null; for(int i=0; i < protocol_list.size(); i++) { current_layer=protocol_list.get(i); if(i + 1 >= protocol_list.size()) break; ...
java
public static Protocol connectProtocols(List<Protocol> protocol_list) throws Exception { Protocol current_layer=null, next_layer=null; for(int i=0; i < protocol_list.size(); i++) { current_layer=protocol_list.get(i); if(i + 1 >= protocol_list.size()) break; ...
[ "public", "static", "Protocol", "connectProtocols", "(", "List", "<", "Protocol", ">", "protocol_list", ")", "throws", "Exception", "{", "Protocol", "current_layer", "=", "null", ",", "next_layer", "=", "null", ";", "for", "(", "int", "i", "=", "0", ";", "...
Creates a protocol stack by iterating through the protocol list and connecting adjacent layers. The list starts with the topmost layer and has the bottommost layer at the tail. @param protocol_list List of Protocol elements (from top to bottom) @return Protocol stack
[ "Creates", "a", "protocol", "stack", "by", "iterating", "through", "the", "protocol", "list", "and", "connecting", "adjacent", "layers", ".", "The", "list", "starts", "with", "the", "topmost", "layer", "and", "has", "the", "bottommost", "layer", "at", "the", ...
bd3ca786aa57fed41dfbc10a94b1281e388be03b
https://github.com/belaban/JGroups/blob/bd3ca786aa57fed41dfbc10a94b1281e388be03b/src/org/jgroups/stack/Configurator.java#L183-L197
52,112
belaban/JGroups
src/org/jgroups/stack/Configurator.java
Configurator.createProtocols
public static List<Protocol> createProtocols(List<ProtocolConfiguration> protocol_configs, final ProtocolStack stack) throws Exception { List<Protocol> retval=new LinkedList<>(); for(int i=0; i < protocol_configs.size(); i++) { ProtocolConfiguration protocol_config=protocol_configs.get(i); ...
java
public static List<Protocol> createProtocols(List<ProtocolConfiguration> protocol_configs, final ProtocolStack stack) throws Exception { List<Protocol> retval=new LinkedList<>(); for(int i=0; i < protocol_configs.size(); i++) { ProtocolConfiguration protocol_config=protocol_configs.get(i); ...
[ "public", "static", "List", "<", "Protocol", ">", "createProtocols", "(", "List", "<", "ProtocolConfiguration", ">", "protocol_configs", ",", "final", "ProtocolStack", "stack", ")", "throws", "Exception", "{", "List", "<", "Protocol", ">", "retval", "=", "new", ...
Takes vector of ProtocolConfigurations, iterates through it, creates Protocol for each ProtocolConfiguration and returns all Protocols in a list. @param protocol_configs List of ProtocolConfigurations @param stack The protocol stack @return List of Protocols
[ "Takes", "vector", "of", "ProtocolConfigurations", "iterates", "through", "it", "creates", "Protocol", "for", "each", "ProtocolConfiguration", "and", "returns", "all", "Protocols", "in", "a", "list", "." ]
bd3ca786aa57fed41dfbc10a94b1281e388be03b
https://github.com/belaban/JGroups/blob/bd3ca786aa57fed41dfbc10a94b1281e388be03b/src/org/jgroups/stack/Configurator.java#L209-L219
52,113
belaban/JGroups
src/org/jgroups/stack/Configurator.java
Configurator.sanityCheck
public static void sanityCheck(List<Protocol> protocols) throws Exception { // check for unique IDs Set<Short> ids=new HashSet<>(); for(Protocol protocol: protocols) { short id=protocol.getId(); if(id > 0 && !ids.add(id)) throw new Exception("Protocol ID ...
java
public static void sanityCheck(List<Protocol> protocols) throws Exception { // check for unique IDs Set<Short> ids=new HashSet<>(); for(Protocol protocol: protocols) { short id=protocol.getId(); if(id > 0 && !ids.add(id)) throw new Exception("Protocol ID ...
[ "public", "static", "void", "sanityCheck", "(", "List", "<", "Protocol", ">", "protocols", ")", "throws", "Exception", "{", "// check for unique IDs", "Set", "<", "Short", ">", "ids", "=", "new", "HashSet", "<>", "(", ")", ";", "for", "(", "Protocol", "pro...
Throws an exception if sanity check fails. Possible sanity check is uniqueness of all protocol names
[ "Throws", "an", "exception", "if", "sanity", "check", "fails", ".", "Possible", "sanity", "check", "is", "uniqueness", "of", "all", "protocol", "names" ]
bd3ca786aa57fed41dfbc10a94b1281e388be03b
https://github.com/belaban/JGroups/blob/bd3ca786aa57fed41dfbc10a94b1281e388be03b/src/org/jgroups/stack/Configurator.java#L295-L332
52,114
belaban/JGroups
src/org/jgroups/stack/Configurator.java
Configurator.removeProvidedUpServices
protected static void removeProvidedUpServices(Protocol protocol, List<Integer> events) { if(protocol == null || events == null) return; for(Protocol prot=protocol.getDownProtocol(); prot != null && !events.isEmpty(); prot=prot.getDownProtocol()) { List<Integer> provided_up_servi...
java
protected static void removeProvidedUpServices(Protocol protocol, List<Integer> events) { if(protocol == null || events == null) return; for(Protocol prot=protocol.getDownProtocol(); prot != null && !events.isEmpty(); prot=prot.getDownProtocol()) { List<Integer> provided_up_servi...
[ "protected", "static", "void", "removeProvidedUpServices", "(", "Protocol", "protocol", ",", "List", "<", "Integer", ">", "events", ")", "{", "if", "(", "protocol", "==", "null", "||", "events", "==", "null", ")", "return", ";", "for", "(", "Protocol", "pr...
Removes all events provided by the protocol below protocol from events @param protocol @param events
[ "Removes", "all", "events", "provided", "by", "the", "protocol", "below", "protocol", "from", "events" ]
bd3ca786aa57fed41dfbc10a94b1281e388be03b
https://github.com/belaban/JGroups/blob/bd3ca786aa57fed41dfbc10a94b1281e388be03b/src/org/jgroups/stack/Configurator.java#L343-L351
52,115
belaban/JGroups
src/org/jgroups/stack/Configurator.java
Configurator.removeProvidedDownServices
protected static void removeProvidedDownServices(Protocol protocol, List<Integer> events) { if(protocol == null || events == null) return; for(Protocol prot=protocol.getUpProtocol(); prot != null && !events.isEmpty(); prot=prot.getUpProtocol()) { List<Integer> provided_down_servi...
java
protected static void removeProvidedDownServices(Protocol protocol, List<Integer> events) { if(protocol == null || events == null) return; for(Protocol prot=protocol.getUpProtocol(); prot != null && !events.isEmpty(); prot=prot.getUpProtocol()) { List<Integer> provided_down_servi...
[ "protected", "static", "void", "removeProvidedDownServices", "(", "Protocol", "protocol", ",", "List", "<", "Integer", ">", "events", ")", "{", "if", "(", "protocol", "==", "null", "||", "events", "==", "null", ")", "return", ";", "for", "(", "Protocol", "...
Removes all events provided by the protocol above protocol from events @param protocol @param events
[ "Removes", "all", "events", "provided", "by", "the", "protocol", "above", "protocol", "from", "events" ]
bd3ca786aa57fed41dfbc10a94b1281e388be03b
https://github.com/belaban/JGroups/blob/bd3ca786aa57fed41dfbc10a94b1281e388be03b/src/org/jgroups/stack/Configurator.java#L358-L366
52,116
belaban/JGroups
src/org/jgroups/stack/Configurator.java
Configurator.getAddresses
public static Collection<InetAddress> getAddresses(Map<String, Map<String, InetAddressInfo>> inetAddressMap) throws Exception { Set<InetAddress> addrs=new HashSet<>(); for(Map.Entry<String, Map<String, InetAddressInfo>> inetAddressMapEntry : inetAddressMap.entrySet()) { Map<String, InetAddr...
java
public static Collection<InetAddress> getAddresses(Map<String, Map<String, InetAddressInfo>> inetAddressMap) throws Exception { Set<InetAddress> addrs=new HashSet<>(); for(Map.Entry<String, Map<String, InetAddressInfo>> inetAddressMapEntry : inetAddressMap.entrySet()) { Map<String, InetAddr...
[ "public", "static", "Collection", "<", "InetAddress", ">", "getAddresses", "(", "Map", "<", "String", ",", "Map", "<", "String", ",", "InetAddressInfo", ">", ">", "inetAddressMap", ")", "throws", "Exception", "{", "Set", "<", "InetAddress", ">", "addrs", "="...
Returns all inet addresses found
[ "Returns", "all", "inet", "addresses", "found" ]
bd3ca786aa57fed41dfbc10a94b1281e388be03b
https://github.com/belaban/JGroups/blob/bd3ca786aa57fed41dfbc10a94b1281e388be03b/src/org/jgroups/stack/Configurator.java#L372-L389
52,117
belaban/JGroups
src/org/jgroups/stack/Configurator.java
Configurator.ensureValidBindAddresses
public static void ensureValidBindAddresses(List<Protocol> protocols) throws Exception { for(Protocol protocol : protocols) { String protocolName=protocol.getName(); //traverse class hierarchy and find all annotated fields and add them to the list if annotated Field[] fields...
java
public static void ensureValidBindAddresses(List<Protocol> protocols) throws Exception { for(Protocol protocol : protocols) { String protocolName=protocol.getName(); //traverse class hierarchy and find all annotated fields and add them to the list if annotated Field[] fields...
[ "public", "static", "void", "ensureValidBindAddresses", "(", "List", "<", "Protocol", ">", "protocols", ")", "throws", "Exception", "{", "for", "(", "Protocol", "protocol", ":", "protocols", ")", "{", "String", "protocolName", "=", "protocol", ".", "getName", ...
Makes sure that all fields annotated with @LocalAddress is (1) an InetAddress and (2) a valid address on any local network interface @param protocols @throws Exception
[ "Makes", "sure", "that", "all", "fields", "annotated", "with" ]
bd3ca786aa57fed41dfbc10a94b1281e388be03b
https://github.com/belaban/JGroups/blob/bd3ca786aa57fed41dfbc10a94b1281e388be03b/src/org/jgroups/stack/Configurator.java#L694-L709
52,118
belaban/JGroups
src/org/jgroups/stack/Configurator.java
Configurator.addPropertyToDependencyList
static void addPropertyToDependencyList(List<AccessibleObject> orderedList, Map<String, AccessibleObject> props, Stack<AccessibleObject> stack, AccessibleObject obj) { if (orderedList.contains(obj)) return ; if (stack.search(obj) > 0) { throw new RuntimeException("Deadlock in @Property ...
java
static void addPropertyToDependencyList(List<AccessibleObject> orderedList, Map<String, AccessibleObject> props, Stack<AccessibleObject> stack, AccessibleObject obj) { if (orderedList.contains(obj)) return ; if (stack.search(obj) > 0) { throw new RuntimeException("Deadlock in @Property ...
[ "static", "void", "addPropertyToDependencyList", "(", "List", "<", "AccessibleObject", ">", "orderedList", ",", "Map", "<", "String", ",", "AccessibleObject", ">", "props", ",", "Stack", "<", "AccessibleObject", ">", "stack", ",", "AccessibleObject", "obj", ")", ...
DFS of dependency graph formed by Property annotations and dependsUpon parameter This is used to create a list of Properties in dependency order
[ "DFS", "of", "dependency", "graph", "formed", "by", "Property", "annotations", "and", "dependsUpon", "parameter", "This", "is", "used", "to", "create", "a", "list", "of", "Properties", "in", "dependency", "order" ]
bd3ca786aa57fed41dfbc10a94b1281e388be03b
https://github.com/belaban/JGroups/blob/bd3ca786aa57fed41dfbc10a94b1281e388be03b/src/org/jgroups/stack/Configurator.java#L803-L827
52,119
belaban/JGroups
src/org/jgroups/util/ExtendedUUID.java
ExtendedUUID.length
public int length() { if(keys == null) return 0; int retval=0; for(byte[] key: keys) if(key != null) retval++; return retval; }
java
public int length() { if(keys == null) return 0; int retval=0; for(byte[] key: keys) if(key != null) retval++; return retval; }
[ "public", "int", "length", "(", ")", "{", "if", "(", "keys", "==", "null", ")", "return", "0", ";", "int", "retval", "=", "0", ";", "for", "(", "byte", "[", "]", "key", ":", "keys", ")", "if", "(", "key", "!=", "null", ")", "retval", "++", ";...
The number of non-null keys
[ "The", "number", "of", "non", "-", "null", "keys" ]
bd3ca786aa57fed41dfbc10a94b1281e388be03b
https://github.com/belaban/JGroups/blob/bd3ca786aa57fed41dfbc10a94b1281e388be03b/src/org/jgroups/util/ExtendedUUID.java#L171-L179
52,120
belaban/JGroups
src/org/jgroups/util/ExtendedUUID.java
ExtendedUUID.resize
protected void resize(int new_length) { if(keys == null) { keys=new byte[Math.min(new_length, 0xff)][]; values=new byte[Math.min(new_length, 0xff)][]; return; } if(new_length > 0xff) { if(keys.length < 0xff) new_length=0xff; ...
java
protected void resize(int new_length) { if(keys == null) { keys=new byte[Math.min(new_length, 0xff)][]; values=new byte[Math.min(new_length, 0xff)][]; return; } if(new_length > 0xff) { if(keys.length < 0xff) new_length=0xff; ...
[ "protected", "void", "resize", "(", "int", "new_length", ")", "{", "if", "(", "keys", "==", "null", ")", "{", "keys", "=", "new", "byte", "[", "Math", ".", "min", "(", "new_length", ",", "0xff", ")", "]", "[", "", "]", ";", "values", "=", "new", ...
Resizes the arrays
[ "Resizes", "the", "arrays" ]
bd3ca786aa57fed41dfbc10a94b1281e388be03b
https://github.com/belaban/JGroups/blob/bd3ca786aa57fed41dfbc10a94b1281e388be03b/src/org/jgroups/util/ExtendedUUID.java#L270-L285
52,121
belaban/JGroups
src/org/jgroups/fork/ForkConfig.java
ForkConfig.parse
public static Map<String,List<ProtocolConfiguration>> parse(InputStream input) throws Exception { DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); factory.setValidating(false); // for now DocumentBuilder builder=factory.newDocumentBuilder(); Document document=builde...
java
public static Map<String,List<ProtocolConfiguration>> parse(InputStream input) throws Exception { DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); factory.setValidating(false); // for now DocumentBuilder builder=factory.newDocumentBuilder(); Document document=builde...
[ "public", "static", "Map", "<", "String", ",", "List", "<", "ProtocolConfiguration", ">", ">", "parse", "(", "InputStream", "input", ")", "throws", "Exception", "{", "DocumentBuilderFactory", "factory", "=", "DocumentBuilderFactory", ".", "newInstance", "(", ")", ...
Parses the input and returns a map of fork-stack IDs and lists of ProtocolConfigurations
[ "Parses", "the", "input", "and", "returns", "a", "map", "of", "fork", "-", "stack", "IDs", "and", "lists", "of", "ProtocolConfigurations" ]
bd3ca786aa57fed41dfbc10a94b1281e388be03b
https://github.com/belaban/JGroups/blob/bd3ca786aa57fed41dfbc10a94b1281e388be03b/src/org/jgroups/fork/ForkConfig.java#L32-L39
52,122
belaban/JGroups
src/org/jgroups/util/Bits.java
Bits.writeInt
public static void writeInt(int num, ByteBuffer buf) { if(num == 0) { buf.put((byte)0); return; } final byte bytes_needed=bytesRequiredFor(num); buf.put(bytes_needed); for(int i=0; i < bytes_needed; i++) buf.put(getByteAt(num, i)); }
java
public static void writeInt(int num, ByteBuffer buf) { if(num == 0) { buf.put((byte)0); return; } final byte bytes_needed=bytesRequiredFor(num); buf.put(bytes_needed); for(int i=0; i < bytes_needed; i++) buf.put(getByteAt(num, i)); }
[ "public", "static", "void", "writeInt", "(", "int", "num", ",", "ByteBuffer", "buf", ")", "{", "if", "(", "num", "==", "0", ")", "{", "buf", ".", "put", "(", "(", "byte", ")", "0", ")", ";", "return", ";", "}", "final", "byte", "bytes_needed", "=...
Writes an int to a ByteBuffer @param num the int to be written @param buf the buffer
[ "Writes", "an", "int", "to", "a", "ByteBuffer" ]
bd3ca786aa57fed41dfbc10a94b1281e388be03b
https://github.com/belaban/JGroups/blob/bd3ca786aa57fed41dfbc10a94b1281e388be03b/src/org/jgroups/util/Bits.java#L86-L95
52,123
belaban/JGroups
src/org/jgroups/util/Bits.java
Bits.writeInt
public static void writeInt(int num, DataOutput out) throws IOException { if(num == 0) { out.write(0); return; } final byte bytes_needed=bytesRequiredFor(num); out.write(bytes_needed); for(int i=0; i < bytes_needed; i++) out.write(getByteAt(num...
java
public static void writeInt(int num, DataOutput out) throws IOException { if(num == 0) { out.write(0); return; } final byte bytes_needed=bytesRequiredFor(num); out.write(bytes_needed); for(int i=0; i < bytes_needed; i++) out.write(getByteAt(num...
[ "public", "static", "void", "writeInt", "(", "int", "num", ",", "DataOutput", "out", ")", "throws", "IOException", "{", "if", "(", "num", "==", "0", ")", "{", "out", ".", "write", "(", "0", ")", ";", "return", ";", "}", "final", "byte", "bytes_needed...
Writes an int to an output stream @param num the int to be written @param out the output stream
[ "Writes", "an", "int", "to", "an", "output", "stream" ]
bd3ca786aa57fed41dfbc10a94b1281e388be03b
https://github.com/belaban/JGroups/blob/bd3ca786aa57fed41dfbc10a94b1281e388be03b/src/org/jgroups/util/Bits.java#L102-L111
52,124
belaban/JGroups
src/org/jgroups/util/Bits.java
Bits.readInt
public static int readInt(ByteBuffer buf) { byte len=buf.get(); if(len == 0) return 0; return makeInt(buf, len); }
java
public static int readInt(ByteBuffer buf) { byte len=buf.get(); if(len == 0) return 0; return makeInt(buf, len); }
[ "public", "static", "int", "readInt", "(", "ByteBuffer", "buf", ")", "{", "byte", "len", "=", "buf", ".", "get", "(", ")", ";", "if", "(", "len", "==", "0", ")", "return", "0", ";", "return", "makeInt", "(", "buf", ",", "len", ")", ";", "}" ]
Reads an int from a buffer. @param buf the buffer @return the int read from the buffer
[ "Reads", "an", "int", "from", "a", "buffer", "." ]
bd3ca786aa57fed41dfbc10a94b1281e388be03b
https://github.com/belaban/JGroups/blob/bd3ca786aa57fed41dfbc10a94b1281e388be03b/src/org/jgroups/util/Bits.java#L137-L142
52,125
belaban/JGroups
src/org/jgroups/util/Bits.java
Bits.readInt
public static int readInt(DataInput in) throws IOException { byte len=in.readByte(); if(len == 0) return 0; return makeInt(in, len); }
java
public static int readInt(DataInput in) throws IOException { byte len=in.readByte(); if(len == 0) return 0; return makeInt(in, len); }
[ "public", "static", "int", "readInt", "(", "DataInput", "in", ")", "throws", "IOException", "{", "byte", "len", "=", "in", ".", "readByte", "(", ")", ";", "if", "(", "len", "==", "0", ")", "return", "0", ";", "return", "makeInt", "(", "in", ",", "l...
Reads an int from an input stream @param in the input stream @return the int read from the input stream
[ "Reads", "an", "int", "from", "an", "input", "stream" ]
bd3ca786aa57fed41dfbc10a94b1281e388be03b
https://github.com/belaban/JGroups/blob/bd3ca786aa57fed41dfbc10a94b1281e388be03b/src/org/jgroups/util/Bits.java#L149-L154
52,126
belaban/JGroups
src/org/jgroups/util/Bits.java
Bits.readLong
public static long readLong(ByteBuffer buf) { byte len=buf.get(); if(len == 0) return 0; return makeLong(buf, len); }
java
public static long readLong(ByteBuffer buf) { byte len=buf.get(); if(len == 0) return 0; return makeLong(buf, len); }
[ "public", "static", "long", "readLong", "(", "ByteBuffer", "buf", ")", "{", "byte", "len", "=", "buf", ".", "get", "(", ")", ";", "if", "(", "len", "==", "0", ")", "return", "0", ";", "return", "makeLong", "(", "buf", ",", "len", ")", ";", "}" ]
Reads a long from a buffer. @param buf the buffer @return the long read from the buffer
[ "Reads", "a", "long", "from", "a", "buffer", "." ]
bd3ca786aa57fed41dfbc10a94b1281e388be03b
https://github.com/belaban/JGroups/blob/bd3ca786aa57fed41dfbc10a94b1281e388be03b/src/org/jgroups/util/Bits.java#L248-L253
52,127
belaban/JGroups
src/org/jgroups/util/Bits.java
Bits.writeFloat
public static void writeFloat(float num, DataOutput out) throws IOException { writeInt(Float.floatToIntBits(num), out); }
java
public static void writeFloat(float num, DataOutput out) throws IOException { writeInt(Float.floatToIntBits(num), out); }
[ "public", "static", "void", "writeFloat", "(", "float", "num", ",", "DataOutput", "out", ")", "throws", "IOException", "{", "writeInt", "(", "Float", ".", "floatToIntBits", "(", "num", ")", ",", "out", ")", ";", "}" ]
Writes a float to an output stream @param num the float to be written @param out the output stream
[ "Writes", "a", "float", "to", "an", "output", "stream" ]
bd3ca786aa57fed41dfbc10a94b1281e388be03b
https://github.com/belaban/JGroups/blob/bd3ca786aa57fed41dfbc10a94b1281e388be03b/src/org/jgroups/util/Bits.java#L490-L492
52,128
belaban/JGroups
src/org/jgroups/util/Bits.java
Bits.writeDouble
public static void writeDouble(double num, DataOutput out) throws IOException { writeLong(Double.doubleToLongBits(num), out); }
java
public static void writeDouble(double num, DataOutput out) throws IOException { writeLong(Double.doubleToLongBits(num), out); }
[ "public", "static", "void", "writeDouble", "(", "double", "num", ",", "DataOutput", "out", ")", "throws", "IOException", "{", "writeLong", "(", "Double", ".", "doubleToLongBits", "(", "num", ")", ",", "out", ")", ";", "}" ]
Writes a double to an output stream @param num the double to be written @param out the output stream
[ "Writes", "a", "double", "to", "an", "output", "stream" ]
bd3ca786aa57fed41dfbc10a94b1281e388be03b
https://github.com/belaban/JGroups/blob/bd3ca786aa57fed41dfbc10a94b1281e388be03b/src/org/jgroups/util/Bits.java#L548-L550
52,129
belaban/JGroups
src/org/jgroups/util/Bits.java
Bits.size
public static int size(AsciiString str) { return str == null? Global.SHORT_SIZE : Global.SHORT_SIZE + str.length(); }
java
public static int size(AsciiString str) { return str == null? Global.SHORT_SIZE : Global.SHORT_SIZE + str.length(); }
[ "public", "static", "int", "size", "(", "AsciiString", "str", ")", "{", "return", "str", "==", "null", "?", "Global", ".", "SHORT_SIZE", ":", "Global", ".", "SHORT_SIZE", "+", "str", ".", "length", "(", ")", ";", "}" ]
Measures the number of bytes required to encode an AsciiSring. @param str the string @return the number of bytes required for encoding str
[ "Measures", "the", "number", "of", "bytes", "required", "to", "encode", "an", "AsciiSring", "." ]
bd3ca786aa57fed41dfbc10a94b1281e388be03b
https://github.com/belaban/JGroups/blob/bd3ca786aa57fed41dfbc10a94b1281e388be03b/src/org/jgroups/util/Bits.java#L748-L750
52,130
belaban/JGroups
src/org/jgroups/util/SubmitToThreadPool.java
SubmitToThreadPool.removeAndDispatchNonBundledMessages
protected void removeAndDispatchNonBundledMessages(MessageBatch oob_batch) { if(oob_batch == null) return; AsciiString tmp=oob_batch.clusterName(); byte[] cname=tmp != null? tmp.chars() : null; for(Iterator<Message> it=oob_batch.iterator(); it.hasNext();) { Messag...
java
protected void removeAndDispatchNonBundledMessages(MessageBatch oob_batch) { if(oob_batch == null) return; AsciiString tmp=oob_batch.clusterName(); byte[] cname=tmp != null? tmp.chars() : null; for(Iterator<Message> it=oob_batch.iterator(); it.hasNext();) { Messag...
[ "protected", "void", "removeAndDispatchNonBundledMessages", "(", "MessageBatch", "oob_batch", ")", "{", "if", "(", "oob_batch", "==", "null", ")", "return", ";", "AsciiString", "tmp", "=", "oob_batch", ".", "clusterName", "(", ")", ";", "byte", "[", "]", "cnam...
Removes messages with flags DONT_BUNDLE and OOB set and executes them in the oob or internal thread pool. JGRP-1737
[ "Removes", "messages", "with", "flags", "DONT_BUNDLE", "and", "OOB", "set", "and", "executes", "them", "in", "the", "oob", "or", "internal", "thread", "pool", ".", "JGRP", "-", "1737" ]
bd3ca786aa57fed41dfbc10a94b1281e388be03b
https://github.com/belaban/JGroups/blob/bd3ca786aa57fed41dfbc10a94b1281e388be03b/src/org/jgroups/util/SubmitToThreadPool.java#L47-L62
52,131
belaban/JGroups
src/org/jgroups/util/CondVar.java
CondVar.waitFor
public void waitFor(Condition condition) { boolean intr=false; lock.lock(); try { while(!condition.isMet()) { try { cond.await(); } catch(InterruptedException e) { intr=true; } ...
java
public void waitFor(Condition condition) { boolean intr=false; lock.lock(); try { while(!condition.isMet()) { try { cond.await(); } catch(InterruptedException e) { intr=true; } ...
[ "public", "void", "waitFor", "(", "Condition", "condition", ")", "{", "boolean", "intr", "=", "false", ";", "lock", ".", "lock", "(", ")", ";", "try", "{", "while", "(", "!", "condition", ".", "isMet", "(", ")", ")", "{", "try", "{", "cond", ".", ...
Blocks until condition is true. @param condition The condition. Must be non-null
[ "Blocks", "until", "condition", "is", "true", "." ]
bd3ca786aa57fed41dfbc10a94b1281e388be03b
https://github.com/belaban/JGroups/blob/bd3ca786aa57fed41dfbc10a94b1281e388be03b/src/org/jgroups/util/CondVar.java#L30-L47
52,132
belaban/JGroups
src/org/jgroups/util/CondVar.java
CondVar.waitFor
public boolean waitFor(Condition condition, long timeout, TimeUnit unit) { boolean intr=false; final long timeout_ns=TimeUnit.NANOSECONDS.convert(timeout, unit); lock.lock(); try { for(long wait_time=timeout_ns, start=System.nanoTime(); wait_time > 0 && !condition.isMet();...
java
public boolean waitFor(Condition condition, long timeout, TimeUnit unit) { boolean intr=false; final long timeout_ns=TimeUnit.NANOSECONDS.convert(timeout, unit); lock.lock(); try { for(long wait_time=timeout_ns, start=System.nanoTime(); wait_time > 0 && !condition.isMet();...
[ "public", "boolean", "waitFor", "(", "Condition", "condition", ",", "long", "timeout", ",", "TimeUnit", "unit", ")", "{", "boolean", "intr", "=", "false", ";", "final", "long", "timeout_ns", "=", "TimeUnit", ".", "NANOSECONDS", ".", "convert", "(", "timeout"...
Blocks until condition is true or the time elapsed @param condition The condition @param timeout The timeout to wait. A value <= 0 causes immediate return @param unit TimeUnit @return The condition's status
[ "Blocks", "until", "condition", "is", "true", "or", "the", "time", "elapsed" ]
bd3ca786aa57fed41dfbc10a94b1281e388be03b
https://github.com/belaban/JGroups/blob/bd3ca786aa57fed41dfbc10a94b1281e388be03b/src/org/jgroups/util/CondVar.java#L56-L76
52,133
belaban/JGroups
src/org/jgroups/protocols/tom/DeliveryManagerImpl.java
DeliveryManagerImpl.deliverSingleDestinationMessage
void deliverSingleDestinationMessage(Message msg, MessageID messageID) { synchronized (deliverySet) { long sequenceNumber = sequenceNumberManager.get(); MessageInfo messageInfo = new MessageInfo(messageID, msg, sequenceNumber); messageInfo.updateAndMarkReadyToDeliver(sequence...
java
void deliverSingleDestinationMessage(Message msg, MessageID messageID) { synchronized (deliverySet) { long sequenceNumber = sequenceNumberManager.get(); MessageInfo messageInfo = new MessageInfo(messageID, msg, sequenceNumber); messageInfo.updateAndMarkReadyToDeliver(sequence...
[ "void", "deliverSingleDestinationMessage", "(", "Message", "msg", ",", "MessageID", "messageID", ")", "{", "synchronized", "(", "deliverySet", ")", "{", "long", "sequenceNumber", "=", "sequenceNumberManager", ".", "get", "(", ")", ";", "MessageInfo", "messageInfo", ...
delivers a message that has only as destination member this node @param msg the message
[ "delivers", "a", "message", "that", "has", "only", "as", "destination", "member", "this", "node" ]
bd3ca786aa57fed41dfbc10a94b1281e388be03b
https://github.com/belaban/JGroups/blob/bd3ca786aa57fed41dfbc10a94b1281e388be03b/src/org/jgroups/protocols/tom/DeliveryManagerImpl.java#L123-L131
52,134
belaban/JGroups
src/org/jgroups/protocols/tom/DeliveryManagerImpl.java
DeliveryManagerImpl.getNextMessagesToDeliver
@Override public List<Message> getNextMessagesToDeliver() throws InterruptedException { LinkedList<Message> toDeliver = new LinkedList<>(); synchronized (deliverySet) { while (deliverySet.isEmpty() || !deliverySet.first().isReadyToDeliver()) { deliverySet.wait(); ...
java
@Override public List<Message> getNextMessagesToDeliver() throws InterruptedException { LinkedList<Message> toDeliver = new LinkedList<>(); synchronized (deliverySet) { while (deliverySet.isEmpty() || !deliverySet.first().isReadyToDeliver()) { deliverySet.wait(); ...
[ "@", "Override", "public", "List", "<", "Message", ">", "getNextMessagesToDeliver", "(", ")", "throws", "InterruptedException", "{", "LinkedList", "<", "Message", ">", "toDeliver", "=", "new", "LinkedList", "<>", "(", ")", ";", "synchronized", "(", "deliverySet"...
see the interface javadoc
[ "see", "the", "interface", "javadoc" ]
bd3ca786aa57fed41dfbc10a94b1281e388be03b
https://github.com/belaban/JGroups/blob/bd3ca786aa57fed41dfbc10a94b1281e388be03b/src/org/jgroups/protocols/tom/DeliveryManagerImpl.java#L175-L196
52,135
belaban/JGroups
src/org/jgroups/View.java
View.containsMember
public boolean containsMember(Address mbr) { if(mbr == null || members == null) return false; for(Address member: members) if(Objects.equals(member, mbr)) return true; return false; }
java
public boolean containsMember(Address mbr) { if(mbr == null || members == null) return false; for(Address member: members) if(Objects.equals(member, mbr)) return true; return false; }
[ "public", "boolean", "containsMember", "(", "Address", "mbr", ")", "{", "if", "(", "mbr", "==", "null", "||", "members", "==", "null", ")", "return", "false", ";", "for", "(", "Address", "member", ":", "members", ")", "if", "(", "Objects", ".", "equals...
Returns true if this view contains a certain member @param mbr - the address of the member, @return true if this view contains the member, false if it doesn't
[ "Returns", "true", "if", "this", "view", "contains", "a", "certain", "member" ]
bd3ca786aa57fed41dfbc10a94b1281e388be03b
https://github.com/belaban/JGroups/blob/bd3ca786aa57fed41dfbc10a94b1281e388be03b/src/org/jgroups/View.java#L141-L148
52,136
belaban/JGroups
src/org/jgroups/View.java
View.containsMembers
public boolean containsMembers(Address ... mbrs) { if(mbrs == null || members == null) return false; for(Address mbr: mbrs) { if(!containsMember(mbr)) return false; } return true; }
java
public boolean containsMembers(Address ... mbrs) { if(mbrs == null || members == null) return false; for(Address mbr: mbrs) { if(!containsMember(mbr)) return false; } return true; }
[ "public", "boolean", "containsMembers", "(", "Address", "...", "mbrs", ")", "{", "if", "(", "mbrs", "==", "null", "||", "members", "==", "null", ")", "return", "false", ";", "for", "(", "Address", "mbr", ":", "mbrs", ")", "{", "if", "(", "!", "contai...
Returns true if all mbrs are elements of this view, false otherwise
[ "Returns", "true", "if", "all", "mbrs", "are", "elements", "of", "this", "view", "false", "otherwise" ]
bd3ca786aa57fed41dfbc10a94b1281e388be03b
https://github.com/belaban/JGroups/blob/bd3ca786aa57fed41dfbc10a94b1281e388be03b/src/org/jgroups/View.java#L151-L159
52,137
belaban/JGroups
src/org/jgroups/View.java
View.leftMembers
public static List<Address> leftMembers(View one, View two) { if(one == null || two == null) return null; List<Address> retval=new ArrayList<>(one.getMembers()); retval.removeAll(two.getMembers()); return retval; }
java
public static List<Address> leftMembers(View one, View two) { if(one == null || two == null) return null; List<Address> retval=new ArrayList<>(one.getMembers()); retval.removeAll(two.getMembers()); return retval; }
[ "public", "static", "List", "<", "Address", ">", "leftMembers", "(", "View", "one", ",", "View", "two", ")", "{", "if", "(", "one", "==", "null", "||", "two", "==", "null", ")", "return", "null", ";", "List", "<", "Address", ">", "retval", "=", "ne...
Returns a list of members which left from view one to two @param one @param two
[ "Returns", "a", "list", "of", "members", "which", "left", "from", "view", "one", "to", "two" ]
bd3ca786aa57fed41dfbc10a94b1281e388be03b
https://github.com/belaban/JGroups/blob/bd3ca786aa57fed41dfbc10a94b1281e388be03b/src/org/jgroups/View.java#L223-L229
52,138
belaban/JGroups
src/org/jgroups/View.java
View.diff
public static Address[][] diff(final View from, final View to) { if(to == null) throw new IllegalArgumentException("the second view cannot be null"); if(from == to) return new Address[][]{{},{}}; if(from == null) { Address[] joined=new Address[to.size()]; ...
java
public static Address[][] diff(final View from, final View to) { if(to == null) throw new IllegalArgumentException("the second view cannot be null"); if(from == to) return new Address[][]{{},{}}; if(from == null) { Address[] joined=new Address[to.size()]; ...
[ "public", "static", "Address", "[", "]", "[", "]", "diff", "(", "final", "View", "from", ",", "final", "View", "to", ")", "{", "if", "(", "to", "==", "null", ")", "throw", "new", "IllegalArgumentException", "(", "\"the second view cannot be null\"", ")", "...
Returns the difference between 2 views from and to. It is assumed that view 'from' is logically prior to view 'to'. @param from The first view @param to The second view @return an array of 2 Address arrays: index 0 has the addresses of the joined member, index 1 those of the left members
[ "Returns", "the", "difference", "between", "2", "views", "from", "and", "to", ".", "It", "is", "assumed", "that", "view", "from", "is", "logically", "prior", "to", "view", "to", "." ]
bd3ca786aa57fed41dfbc10a94b1281e388be03b
https://github.com/belaban/JGroups/blob/bd3ca786aa57fed41dfbc10a94b1281e388be03b/src/org/jgroups/View.java#L245-L286
52,139
belaban/JGroups
src/org/jgroups/View.java
View.sameViews
public static boolean sameViews(View ... views) { ViewId first_view_id=views[0].getViewId(); return Stream.of(views).allMatch(v -> v.getViewId().equals(first_view_id)); }
java
public static boolean sameViews(View ... views) { ViewId first_view_id=views[0].getViewId(); return Stream.of(views).allMatch(v -> v.getViewId().equals(first_view_id)); }
[ "public", "static", "boolean", "sameViews", "(", "View", "...", "views", ")", "{", "ViewId", "first_view_id", "=", "views", "[", "0", "]", ".", "getViewId", "(", ")", ";", "return", "Stream", ".", "of", "(", "views", ")", ".", "allMatch", "(", "v", "...
Returns true if all views are the same. Uses the view IDs for comparison
[ "Returns", "true", "if", "all", "views", "are", "the", "same", ".", "Uses", "the", "view", "IDs", "for", "comparison" ]
bd3ca786aa57fed41dfbc10a94b1281e388be03b
https://github.com/belaban/JGroups/blob/bd3ca786aa57fed41dfbc10a94b1281e388be03b/src/org/jgroups/View.java#L289-L292
52,140
belaban/JGroups
src/org/jgroups/Message.java
Message.getBuffer
public byte[] getBuffer() { if(buf == null) return null; if(offset == 0 && length == buf.length) return buf; else { byte[] retval=new byte[length]; System.arraycopy(buf, offset, retval, 0, length); return retval; } }
java
public byte[] getBuffer() { if(buf == null) return null; if(offset == 0 && length == buf.length) return buf; else { byte[] retval=new byte[length]; System.arraycopy(buf, offset, retval, 0, length); return retval; } }
[ "public", "byte", "[", "]", "getBuffer", "(", ")", "{", "if", "(", "buf", "==", "null", ")", "return", "null", ";", "if", "(", "offset", "==", "0", "&&", "length", "==", "buf", ".", "length", ")", "return", "buf", ";", "else", "{", "byte", "[", ...
Returns a copy of the buffer if offset and length are used, otherwise a reference. @return byte array with a copy of the buffer.
[ "Returns", "a", "copy", "of", "the", "buffer", "if", "offset", "and", "length", "are", "used", "otherwise", "a", "reference", "." ]
bd3ca786aa57fed41dfbc10a94b1281e388be03b
https://github.com/belaban/JGroups/blob/bd3ca786aa57fed41dfbc10a94b1281e388be03b/src/org/jgroups/Message.java#L198-L208
52,141
belaban/JGroups
src/org/jgroups/Message.java
Message.setFlag
public Message setFlag(Flag ... flags) { if(flags != null) { short tmp=this.flags; for(Flag flag : flags) { if(flag != null) tmp|=flag.value(); } this.flags=tmp; } return this; }
java
public Message setFlag(Flag ... flags) { if(flags != null) { short tmp=this.flags; for(Flag flag : flags) { if(flag != null) tmp|=flag.value(); } this.flags=tmp; } return this; }
[ "public", "Message", "setFlag", "(", "Flag", "...", "flags", ")", "{", "if", "(", "flags", "!=", "null", ")", "{", "short", "tmp", "=", "this", ".", "flags", ";", "for", "(", "Flag", "flag", ":", "flags", ")", "{", "if", "(", "flag", "!=", "null"...
Sets a number of flags in a message @param flags The flag or flags @return A reference to the message
[ "Sets", "a", "number", "of", "flags", "in", "a", "message" ]
bd3ca786aa57fed41dfbc10a94b1281e388be03b
https://github.com/belaban/JGroups/blob/bd3ca786aa57fed41dfbc10a94b1281e388be03b/src/org/jgroups/Message.java#L337-L347
52,142
belaban/JGroups
src/org/jgroups/Message.java
Message.clearFlag
public Message clearFlag(Flag ... flags) { if(flags != null) { short tmp=this.flags; for(Flag flag : flags) if(flag != null) tmp&=~flag.value(); this.flags=tmp; } return this; }
java
public Message clearFlag(Flag ... flags) { if(flags != null) { short tmp=this.flags; for(Flag flag : flags) if(flag != null) tmp&=~flag.value(); this.flags=tmp; } return this; }
[ "public", "Message", "clearFlag", "(", "Flag", "...", "flags", ")", "{", "if", "(", "flags", "!=", "null", ")", "{", "short", "tmp", "=", "this", ".", "flags", ";", "for", "(", "Flag", "flag", ":", "flags", ")", "if", "(", "flag", "!=", "null", "...
Clears a number of flags in a message @param flags The flags @return A reference to the message
[ "Clears", "a", "number", "of", "flags", "in", "a", "message" ]
bd3ca786aa57fed41dfbc10a94b1281e388be03b
https://github.com/belaban/JGroups/blob/bd3ca786aa57fed41dfbc10a94b1281e388be03b/src/org/jgroups/Message.java#L398-L407
52,143
belaban/JGroups
src/org/jgroups/Message.java
Message.putHeader
public Message putHeader(short id, Header hdr) { if(id < 0) throw new IllegalArgumentException("An ID of " + id + " is invalid"); if(hdr != null) hdr.setProtId(id); synchronized(this) { Header[] resized_array=Headers.putHeader(this.headers, id, hdr, true); ...
java
public Message putHeader(short id, Header hdr) { if(id < 0) throw new IllegalArgumentException("An ID of " + id + " is invalid"); if(hdr != null) hdr.setProtId(id); synchronized(this) { Header[] resized_array=Headers.putHeader(this.headers, id, hdr, true); ...
[ "public", "Message", "putHeader", "(", "short", "id", ",", "Header", "hdr", ")", "{", "if", "(", "id", "<", "0", ")", "throw", "new", "IllegalArgumentException", "(", "\"An ID of \"", "+", "id", "+", "\" is invalid\"", ")", ";", "if", "(", "hdr", "!=", ...
Puts a header given an ID into the hashmap. Overwrites potential existing entry.
[ "Puts", "a", "header", "given", "an", "ID", "into", "the", "hashmap", ".", "Overwrites", "potential", "existing", "entry", "." ]
bd3ca786aa57fed41dfbc10a94b1281e388be03b
https://github.com/belaban/JGroups/blob/bd3ca786aa57fed41dfbc10a94b1281e388be03b/src/org/jgroups/Message.java#L460-L471
52,144
belaban/JGroups
src/org/jgroups/Message.java
Message.getHeader
public <T extends Header> T getHeader(short ... ids) { if(ids == null || ids.length == 0) return null; return Headers.getHeader(this.headers, ids); }
java
public <T extends Header> T getHeader(short ... ids) { if(ids == null || ids.length == 0) return null; return Headers.getHeader(this.headers, ids); }
[ "public", "<", "T", "extends", "Header", ">", "T", "getHeader", "(", "short", "...", "ids", ")", "{", "if", "(", "ids", "==", "null", "||", "ids", ".", "length", "==", "0", ")", "return", "null", ";", "return", "Headers", ".", "getHeader", "(", "th...
Returns a header for a range of IDs, or null if not found
[ "Returns", "a", "header", "for", "a", "range", "of", "IDs", "or", "null", "if", "not", "found" ]
bd3ca786aa57fed41dfbc10a94b1281e388be03b
https://github.com/belaban/JGroups/blob/bd3ca786aa57fed41dfbc10a94b1281e388be03b/src/org/jgroups/Message.java#L483-L487
52,145
belaban/JGroups
src/org/jgroups/Message.java
Message.copy
public Message copy(boolean copy_buffer, short starting_id, short ... copy_only_ids) { Message retval=copy(copy_buffer, false); for(Map.Entry<Short,Header> entry: getHeaders().entrySet()) { short id=entry.getKey(); if(id >= starting_id || Util.containsId(id, copy_only_ids)) ...
java
public Message copy(boolean copy_buffer, short starting_id, short ... copy_only_ids) { Message retval=copy(copy_buffer, false); for(Map.Entry<Short,Header> entry: getHeaders().entrySet()) { short id=entry.getKey(); if(id >= starting_id || Util.containsId(id, copy_only_ids)) ...
[ "public", "Message", "copy", "(", "boolean", "copy_buffer", ",", "short", "starting_id", ",", "short", "...", "copy_only_ids", ")", "{", "Message", "retval", "=", "copy", "(", "copy_buffer", ",", "false", ")", ";", "for", "(", "Map", ".", "Entry", "<", "...
Copies a message. Copies only headers with IDs >= starting_id or IDs which are in the copy_only_ids list @param copy_buffer @param starting_id @param copy_only_ids @return
[ "Copies", "a", "message", ".", "Copies", "only", "headers", "with", "IDs", ">", "=", "starting_id", "or", "IDs", "which", "are", "in", "the", "copy_only_ids", "list" ]
bd3ca786aa57fed41dfbc10a94b1281e388be03b
https://github.com/belaban/JGroups/blob/bd3ca786aa57fed41dfbc10a94b1281e388be03b/src/org/jgroups/Message.java#L554-L562
52,146
belaban/JGroups
src/org/jgroups/Message.java
Message.writeTo
@Override public void writeTo(DataOutput out) throws IOException { byte leading=0; if(dest != null) leading=Util.setFlag(leading, DEST_SET); if(sender != null) leading=Util.setFlag(leading, SRC_SET); if(buf != null) leading=Util.setFlag(leading, BUF...
java
@Override public void writeTo(DataOutput out) throws IOException { byte leading=0; if(dest != null) leading=Util.setFlag(leading, DEST_SET); if(sender != null) leading=Util.setFlag(leading, SRC_SET); if(buf != null) leading=Util.setFlag(leading, BUF...
[ "@", "Override", "public", "void", "writeTo", "(", "DataOutput", "out", ")", "throws", "IOException", "{", "byte", "leading", "=", "0", ";", "if", "(", "dest", "!=", "null", ")", "leading", "=", "Util", ".", "setFlag", "(", "leading", ",", "DEST_SET", ...
Writes the message to the output stream
[ "Writes", "the", "message", "to", "the", "output", "stream" ]
bd3ca786aa57fed41dfbc10a94b1281e388be03b
https://github.com/belaban/JGroups/blob/bd3ca786aa57fed41dfbc10a94b1281e388be03b/src/org/jgroups/Message.java#L594-L638
52,147
belaban/JGroups
src/org/jgroups/Message.java
Message.writeToNoAddrs
public void writeToNoAddrs(Address src, DataOutput out, short ... excluded_headers) throws IOException { byte leading=0; boolean write_src_addr=src == null || sender != null && !sender.equals(src); if(write_src_addr) leading=Util.setFlag(leading, SRC_SET); if(buf != null) ...
java
public void writeToNoAddrs(Address src, DataOutput out, short ... excluded_headers) throws IOException { byte leading=0; boolean write_src_addr=src == null || sender != null && !sender.equals(src); if(write_src_addr) leading=Util.setFlag(leading, SRC_SET); if(buf != null) ...
[ "public", "void", "writeToNoAddrs", "(", "Address", "src", ",", "DataOutput", "out", ",", "short", "...", "excluded_headers", ")", "throws", "IOException", "{", "byte", "leading", "=", "0", ";", "boolean", "write_src_addr", "=", "src", "==", "null", "||", "s...
Writes the message to the output stream, but excludes the dest and src addresses unless the src address given as argument is different from the message's src address @param excluded_headers Don't marshal headers that are part of excluded_headers
[ "Writes", "the", "message", "to", "the", "output", "stream", "but", "excludes", "the", "dest", "and", "src", "addresses", "unless", "the", "src", "address", "given", "as", "argument", "is", "different", "from", "the", "message", "s", "src", "address" ]
bd3ca786aa57fed41dfbc10a94b1281e388be03b
https://github.com/belaban/JGroups/blob/bd3ca786aa57fed41dfbc10a94b1281e388be03b/src/org/jgroups/Message.java#L645-L687
52,148
belaban/JGroups
src/org/jgroups/Message.java
Message.readFrom
@Override public void readFrom(DataInput in) throws IOException, ClassNotFoundException { // 1. read the leading byte first byte leading=in.readByte(); // 2. the flags flags=in.readShort(); // 3. dest_addr if(Util.isFlagSet(leading, DEST_SET)) dest=Util.read...
java
@Override public void readFrom(DataInput in) throws IOException, ClassNotFoundException { // 1. read the leading byte first byte leading=in.readByte(); // 2. the flags flags=in.readShort(); // 3. dest_addr if(Util.isFlagSet(leading, DEST_SET)) dest=Util.read...
[ "@", "Override", "public", "void", "readFrom", "(", "DataInput", "in", ")", "throws", "IOException", ",", "ClassNotFoundException", "{", "// 1. read the leading byte first", "byte", "leading", "=", "in", ".", "readByte", "(", ")", ";", "// 2. the flags", "flags", ...
Reads the message's contents from an input stream
[ "Reads", "the", "message", "s", "contents", "from", "an", "input", "stream" ]
bd3ca786aa57fed41dfbc10a94b1281e388be03b
https://github.com/belaban/JGroups/blob/bd3ca786aa57fed41dfbc10a94b1281e388be03b/src/org/jgroups/Message.java#L690-L721
52,149
belaban/JGroups
src/org/jgroups/stack/RouterStubManager.java
RouterStubManager.forEach
public void forEach(Consumer<RouterStub> action) { stubs.stream().filter(RouterStub::isConnected).forEach(action::accept); }
java
public void forEach(Consumer<RouterStub> action) { stubs.stream().filter(RouterStub::isConnected).forEach(action::accept); }
[ "public", "void", "forEach", "(", "Consumer", "<", "RouterStub", ">", "action", ")", "{", "stubs", ".", "stream", "(", ")", ".", "filter", "(", "RouterStub", "::", "isConnected", ")", ".", "forEach", "(", "action", "::", "accept", ")", ";", "}" ]
Applies action to all RouterStubs that are connected @param action
[ "Applies", "action", "to", "all", "RouterStubs", "that", "are", "connected" ]
bd3ca786aa57fed41dfbc10a94b1281e388be03b
https://github.com/belaban/JGroups/blob/bd3ca786aa57fed41dfbc10a94b1281e388be03b/src/org/jgroups/stack/RouterStubManager.java#L74-L76
52,150
belaban/JGroups
src/org/jgroups/stack/RouterStubManager.java
RouterStubManager.forAny
public void forAny(Consumer<RouterStub> action) { while(!stubs.isEmpty()) { RouterStub stub=Util.pickRandomElement(stubs); if(stub != null && stub.isConnected()) { action.accept(stub); return; } } }
java
public void forAny(Consumer<RouterStub> action) { while(!stubs.isEmpty()) { RouterStub stub=Util.pickRandomElement(stubs); if(stub != null && stub.isConnected()) { action.accept(stub); return; } } }
[ "public", "void", "forAny", "(", "Consumer", "<", "RouterStub", ">", "action", ")", "{", "while", "(", "!", "stubs", ".", "isEmpty", "(", ")", ")", "{", "RouterStub", "stub", "=", "Util", ".", "pickRandomElement", "(", "stubs", ")", ";", "if", "(", "...
Applies action to a randomly picked RouterStub that's connected @param action
[ "Applies", "action", "to", "a", "randomly", "picked", "RouterStub", "that", "s", "connected" ]
bd3ca786aa57fed41dfbc10a94b1281e388be03b
https://github.com/belaban/JGroups/blob/bd3ca786aa57fed41dfbc10a94b1281e388be03b/src/org/jgroups/stack/RouterStubManager.java#L82-L90
52,151
belaban/JGroups
src/org/jgroups/util/Pool.java
Pool.get
public Element<T> get() { // start at a random index, so different threads don't all start at index 0 and compete for the lock int starting_index=((int)(Math.random() * pool.length)) & (pool.length - 1); for(int i=0; i < locks.length; i++) { int index=(starting_index + i) & (pool.len...
java
public Element<T> get() { // start at a random index, so different threads don't all start at index 0 and compete for the lock int starting_index=((int)(Math.random() * pool.length)) & (pool.length - 1); for(int i=0; i < locks.length; i++) { int index=(starting_index + i) & (pool.len...
[ "public", "Element", "<", "T", ">", "get", "(", ")", "{", "// start at a random index, so different threads don't all start at index 0 and compete for the lock", "int", "starting_index", "=", "(", "(", "int", ")", "(", "Math", ".", "random", "(", ")", "*", "pool", "...
Gets the next available resource for which the lock can be acquired and returns it and its associated lock, which needs to be released when the caller is done using the resource. If no resource in the pool can be locked, returns a newly created resource and a null lock. This means that no lock was acquired and thus doe...
[ "Gets", "the", "next", "available", "resource", "for", "which", "the", "lock", "can", "be", "acquired", "and", "returns", "it", "and", "its", "associated", "lock", "which", "needs", "to", "be", "released", "when", "the", "caller", "is", "done", "using", "t...
bd3ca786aa57fed41dfbc10a94b1281e388be03b
https://github.com/belaban/JGroups/blob/bd3ca786aa57fed41dfbc10a94b1281e388be03b/src/org/jgroups/util/Pool.java#L49-L62
52,152
belaban/JGroups
src/org/jgroups/jmx/ResourceDMBean.java
ResourceDMBean.toLowerCase
protected static String toLowerCase(String input) { if(Character.isUpperCase(input.charAt(0))) return input.substring(0, 1).toLowerCase() + input.substring(1); return input; }
java
protected static String toLowerCase(String input) { if(Character.isUpperCase(input.charAt(0))) return input.substring(0, 1).toLowerCase() + input.substring(1); return input; }
[ "protected", "static", "String", "toLowerCase", "(", "String", "input", ")", "{", "if", "(", "Character", ".", "isUpperCase", "(", "input", ".", "charAt", "(", "0", ")", ")", ")", "return", "input", ".", "substring", "(", "0", ",", "1", ")", ".", "to...
Returns a string with the first letter being lowercase
[ "Returns", "a", "string", "with", "the", "first", "letter", "being", "lowercase" ]
bd3ca786aa57fed41dfbc10a94b1281e388be03b
https://github.com/belaban/JGroups/blob/bd3ca786aa57fed41dfbc10a94b1281e388be03b/src/org/jgroups/jmx/ResourceDMBean.java#L386-L390
52,153
belaban/JGroups
src/org/jgroups/protocols/SEQUENCER2.java
SEQUENCER2.handleTmpView
private void handleTmpView(View v) { Address new_coord=v.getCoord(); if(new_coord != null && !new_coord.equals(coord) && local_addr != null && local_addr.equals(new_coord)) handleViewChange(v); }
java
private void handleTmpView(View v) { Address new_coord=v.getCoord(); if(new_coord != null && !new_coord.equals(coord) && local_addr != null && local_addr.equals(new_coord)) handleViewChange(v); }
[ "private", "void", "handleTmpView", "(", "View", "v", ")", "{", "Address", "new_coord", "=", "v", ".", "getCoord", "(", ")", ";", "if", "(", "new_coord", "!=", "null", "&&", "!", "new_coord", ".", "equals", "(", "coord", ")", "&&", "local_addr", "!=", ...
an immediate change of view. See JGRP-1452.
[ "an", "immediate", "change", "of", "view", ".", "See", "JGRP", "-", "1452", "." ]
bd3ca786aa57fed41dfbc10a94b1281e388be03b
https://github.com/belaban/JGroups/blob/bd3ca786aa57fed41dfbc10a94b1281e388be03b/src/org/jgroups/protocols/SEQUENCER2.java#L310-L314
52,154
belaban/JGroups
src/org/jgroups/demos/QuoteServer.java
QuoteServer.integrate
private void integrate(HashMap<String,Float> state) { if(state != null) state.keySet().forEach(key -> stocks.put(key, state.get(key))); }
java
private void integrate(HashMap<String,Float> state) { if(state != null) state.keySet().forEach(key -> stocks.put(key, state.get(key))); }
[ "private", "void", "integrate", "(", "HashMap", "<", "String", ",", "Float", ">", "state", ")", "{", "if", "(", "state", "!=", "null", ")", "state", ".", "keySet", "(", ")", ".", "forEach", "(", "key", "->", "stocks", ".", "put", "(", "key", ",", ...
default stack from JChannel
[ "default", "stack", "from", "JChannel" ]
bd3ca786aa57fed41dfbc10a94b1281e388be03b
https://github.com/belaban/JGroups/blob/bd3ca786aa57fed41dfbc10a94b1281e388be03b/src/org/jgroups/demos/QuoteServer.java#L39-L42
52,155
belaban/JGroups
src/org/jgroups/util/BlockingInputStream.java
BlockingInputStream.sanityCheck
protected static void sanityCheck(byte[] buf, int offset, int length) { if(buf == null) throw new NullPointerException("buffer is null"); if(offset + length > buf.length) throw new ArrayIndexOutOfBoundsException("length (" + length + ") + offset (" + offset + ...
java
protected static void sanityCheck(byte[] buf, int offset, int length) { if(buf == null) throw new NullPointerException("buffer is null"); if(offset + length > buf.length) throw new ArrayIndexOutOfBoundsException("length (" + length + ") + offset (" + offset + ...
[ "protected", "static", "void", "sanityCheck", "(", "byte", "[", "]", "buf", ",", "int", "offset", ",", "int", "length", ")", "{", "if", "(", "buf", "==", "null", ")", "throw", "new", "NullPointerException", "(", "\"buffer is null\"", ")", ";", "if", "(",...
Verifies that length doesn't exceed a buffer's length @param buf @param offset @param length
[ "Verifies", "that", "length", "doesn", "t", "exceed", "a", "buffer", "s", "length" ]
bd3ca786aa57fed41dfbc10a94b1281e388be03b
https://github.com/belaban/JGroups/blob/bd3ca786aa57fed41dfbc10a94b1281e388be03b/src/org/jgroups/util/BlockingInputStream.java#L260-L265
52,156
belaban/JGroups
src/org/jgroups/auth/X509Token.java
X509Token.setCertificate
public void setCertificate() throws KeyStoreException, IOException, NoSuchAlgorithmException, CertificateException, NoSuchPaddingException, InvalidKeyException, IllegalBlockSizeException, BadPaddingException, UnrecoverableEntryException { KeyStore store = KeyStore.getInst...
java
public void setCertificate() throws KeyStoreException, IOException, NoSuchAlgorithmException, CertificateException, NoSuchPaddingException, InvalidKeyException, IllegalBlockSizeException, BadPaddingException, UnrecoverableEntryException { KeyStore store = KeyStore.getInst...
[ "public", "void", "setCertificate", "(", ")", "throws", "KeyStoreException", ",", "IOException", ",", "NoSuchAlgorithmException", ",", "CertificateException", ",", "NoSuchPaddingException", ",", "InvalidKeyException", ",", "IllegalBlockSizeException", ",", "BadPaddingExceptio...
Used during setup to get the certification from the keystore and encrypt the auth_value with the private key
[ "Used", "during", "setup", "to", "get", "the", "certification", "from", "the", "keystore", "and", "encrypt", "the", "auth_value", "with", "the", "private", "key" ]
bd3ca786aa57fed41dfbc10a94b1281e388be03b
https://github.com/belaban/JGroups/blob/bd3ca786aa57fed41dfbc10a94b1281e388be03b/src/org/jgroups/auth/X509Token.java#L145-L167
52,157
belaban/JGroups
src/org/jgroups/util/Headers.java
Headers.getHeader
public static <T extends Header> T getHeader(final Header[] hdrs, short id) { if(hdrs == null) return null; for(Header hdr: hdrs) { if(hdr == null) return null; if(hdr.getProtId() == id) return (T)hdr; } return null; ...
java
public static <T extends Header> T getHeader(final Header[] hdrs, short id) { if(hdrs == null) return null; for(Header hdr: hdrs) { if(hdr == null) return null; if(hdr.getProtId() == id) return (T)hdr; } return null; ...
[ "public", "static", "<", "T", "extends", "Header", ">", "T", "getHeader", "(", "final", "Header", "[", "]", "hdrs", ",", "short", "id", ")", "{", "if", "(", "hdrs", "==", "null", ")", "return", "null", ";", "for", "(", "Header", "hdr", ":", "hdrs",...
Returns the header associated with an ID @param id The ID @return
[ "Returns", "the", "header", "associated", "with", "an", "ID" ]
bd3ca786aa57fed41dfbc10a94b1281e388be03b
https://github.com/belaban/JGroups/blob/bd3ca786aa57fed41dfbc10a94b1281e388be03b/src/org/jgroups/util/Headers.java#L39-L49
52,158
belaban/JGroups
src/org/jgroups/util/Headers.java
Headers.putHeader
public static Header[] putHeader(final Header[] headers, short id, Header hdr, boolean replace_if_present) { int i=0; Header[] hdrs=headers; boolean resized=false; while(i < hdrs.length) { if(hdrs[i] == null) { hdrs[i]=hdr; return resized? hdrs...
java
public static Header[] putHeader(final Header[] headers, short id, Header hdr, boolean replace_if_present) { int i=0; Header[] hdrs=headers; boolean resized=false; while(i < hdrs.length) { if(hdrs[i] == null) { hdrs[i]=hdr; return resized? hdrs...
[ "public", "static", "Header", "[", "]", "putHeader", "(", "final", "Header", "[", "]", "headers", ",", "short", "id", ",", "Header", "hdr", ",", "boolean", "replace_if_present", ")", "{", "int", "i", "=", "0", ";", "Header", "[", "]", "hdrs", "=", "h...
Adds hdr at the next available slot. If none is available, the headers array passed in will be copied and the copy returned @param headers The headers array @param id The protocol ID of the header @param hdr The header @param replace_if_present Whether or not to overwrite an existing header @return A new copy of header...
[ "Adds", "hdr", "at", "the", "next", "available", "slot", ".", "If", "none", "is", "available", "the", "headers", "array", "passed", "in", "will", "be", "copied", "and", "the", "copy", "returned" ]
bd3ca786aa57fed41dfbc10a94b1281e388be03b
https://github.com/belaban/JGroups/blob/bd3ca786aa57fed41dfbc10a94b1281e388be03b/src/org/jgroups/util/Headers.java#L114-L136
52,159
belaban/JGroups
src/org/jgroups/util/Headers.java
Headers.resize
public static Header[] resize(final Header[] headers) { int new_capacity=headers.length + RESIZE_INCR; Header[] new_hdrs=new Header[new_capacity]; System.arraycopy(headers, 0, new_hdrs, 0, headers.length); return new_hdrs; }
java
public static Header[] resize(final Header[] headers) { int new_capacity=headers.length + RESIZE_INCR; Header[] new_hdrs=new Header[new_capacity]; System.arraycopy(headers, 0, new_hdrs, 0, headers.length); return new_hdrs; }
[ "public", "static", "Header", "[", "]", "resize", "(", "final", "Header", "[", "]", "headers", ")", "{", "int", "new_capacity", "=", "headers", ".", "length", "+", "RESIZE_INCR", ";", "Header", "[", "]", "new_hdrs", "=", "new", "Header", "[", "new_capaci...
Increases the capacity of the array and copies the contents of the old into the new array
[ "Increases", "the", "capacity", "of", "the", "array", "and", "copies", "the", "contents", "of", "the", "old", "into", "the", "new", "array" ]
bd3ca786aa57fed41dfbc10a94b1281e388be03b
https://github.com/belaban/JGroups/blob/bd3ca786aa57fed41dfbc10a94b1281e388be03b/src/org/jgroups/util/Headers.java#L141-L146
52,160
belaban/JGroups
src/org/jgroups/protocols/RingBufferBundler.java
RingBufferBundler.print
protected static String print(BiConsumer<Integer,Integer> wait_strategy) { if(wait_strategy == null) return null; if(wait_strategy == SPIN) return "spin"; else if(wait_strategy == YIELD) return "yield"; else if(wait_strategy == PARK) r...
java
protected static String print(BiConsumer<Integer,Integer> wait_strategy) { if(wait_strategy == null) return null; if(wait_strategy == SPIN) return "spin"; else if(wait_strategy == YIELD) return "yield"; else if(wait_strategy == PARK) r...
[ "protected", "static", "String", "print", "(", "BiConsumer", "<", "Integer", ",", "Integer", ">", "wait_strategy", ")", "{", "if", "(", "wait_strategy", "==", "null", ")", "return", "null", ";", "if", "(", "wait_strategy", "==", "SPIN", ")", "return", "\"s...
fast equivalent to %
[ "fast", "equivalent", "to", "%" ]
bd3ca786aa57fed41dfbc10a94b1281e388be03b
https://github.com/belaban/JGroups/blob/bd3ca786aa57fed41dfbc10a94b1281e388be03b/src/org/jgroups/protocols/RingBufferBundler.java#L172-L180
52,161
belaban/JGroups
src/org/jgroups/protocols/pbcast/CoordGmsImpl.java
CoordGmsImpl.leave
public void leave(Address mbr) { if(mbr == null) { if(log.isErrorEnabled()) log.error(Util.getMessage("MemberSAddressIsNull")); return; } ViewHandler<Request> vh=gms.getViewHandler(); vh.add(new Request(Request.COORD_LEAVE, mbr)); // https://issues.jboss.org/brows...
java
public void leave(Address mbr) { if(mbr == null) { if(log.isErrorEnabled()) log.error(Util.getMessage("MemberSAddressIsNull")); return; } ViewHandler<Request> vh=gms.getViewHandler(); vh.add(new Request(Request.COORD_LEAVE, mbr)); // https://issues.jboss.org/brows...
[ "public", "void", "leave", "(", "Address", "mbr", ")", "{", "if", "(", "mbr", "==", "null", ")", "{", "if", "(", "log", ".", "isErrorEnabled", "(", ")", ")", "log", ".", "error", "(", "Util", ".", "getMessage", "(", "\"MemberSAddressIsNull\"", ")", "...
The coordinator itself wants to leave the group
[ "The", "coordinator", "itself", "wants", "to", "leave", "the", "group" ]
bd3ca786aa57fed41dfbc10a94b1281e388be03b
https://github.com/belaban/JGroups/blob/bd3ca786aa57fed41dfbc10a94b1281e388be03b/src/org/jgroups/protocols/pbcast/CoordGmsImpl.java#L47-L57
52,162
belaban/JGroups
src/org/jgroups/protocols/FRAG.java
FRAG.unfragment
private Message unfragment(Message msg, FragHeader hdr) { Address sender=msg.getSrc(); FragmentationTable frag_table=fragment_list.get(sender); if(frag_table == null) { frag_table=new FragmentationTable(sender); try { fragment_list.add(sender, f...
java
private Message unfragment(Message msg, FragHeader hdr) { Address sender=msg.getSrc(); FragmentationTable frag_table=fragment_list.get(sender); if(frag_table == null) { frag_table=new FragmentationTable(sender); try { fragment_list.add(sender, f...
[ "private", "Message", "unfragment", "(", "Message", "msg", ",", "FragHeader", "hdr", ")", "{", "Address", "sender", "=", "msg", ".", "getSrc", "(", ")", ";", "FragmentationTable", "frag_table", "=", "fragment_list", ".", "get", "(", "sender", ")", ";", "if...
1. Get all the fragment buffers 2. When all are received -> Assemble them into one big buffer 3. Read headers and byte buffer from big buffer 4. Set headers and buffer in msg 5. Pass msg up the stack
[ "1", ".", "Get", "all", "the", "fragment", "buffers", "2", ".", "When", "all", "are", "received", "-", ">", "Assemble", "them", "into", "one", "big", "buffer", "3", ".", "Read", "headers", "and", "byte", "buffer", "from", "big", "buffer", "4", ".", "...
bd3ca786aa57fed41dfbc10a94b1281e388be03b
https://github.com/belaban/JGroups/blob/bd3ca786aa57fed41dfbc10a94b1281e388be03b/src/org/jgroups/protocols/FRAG.java#L234-L264
52,163
belaban/JGroups
src/org/jgroups/util/NonBlockingCredit.java
NonBlockingCredit.decrementIfEnoughCredits
public boolean decrementIfEnoughCredits(final Message msg, int credits, long timeout) { lock.lock(); try { if(queuing) return addToQueue(msg, credits); if(decrement(credits)) return true; // enough credits, message will be sent queuing=...
java
public boolean decrementIfEnoughCredits(final Message msg, int credits, long timeout) { lock.lock(); try { if(queuing) return addToQueue(msg, credits); if(decrement(credits)) return true; // enough credits, message will be sent queuing=...
[ "public", "boolean", "decrementIfEnoughCredits", "(", "final", "Message", "msg", ",", "int", "credits", ",", "long", "timeout", ")", "{", "lock", ".", "lock", "(", ")", ";", "try", "{", "if", "(", "queuing", ")", "return", "addToQueue", "(", "msg", ",", ...
Decrements the sender's credits by the size of the message. @param msg The message @param credits The number of bytes to decrement the credits. Is {@link Message#length()}. @param timeout Ignored @return True if the message was sent, false if it was queued
[ "Decrements", "the", "sender", "s", "credits", "by", "the", "size", "of", "the", "message", "." ]
bd3ca786aa57fed41dfbc10a94b1281e388be03b
https://github.com/belaban/JGroups/blob/bd3ca786aa57fed41dfbc10a94b1281e388be03b/src/org/jgroups/util/NonBlockingCredit.java#L54-L67
52,164
belaban/JGroups
src/org/jgroups/conf/ClassConfigurator.java
ClassConfigurator.add
public static void add(short magic, Class clazz) { if(magic < MIN_CUSTOM_MAGIC_NUMBER) throw new IllegalArgumentException("magic ID (" + magic + ") must be >= " + MIN_CUSTOM_MAGIC_NUMBER); if(magicMapUser.containsKey(magic) || classMap.containsKey(clazz)) alreadyInMagicMap(magic,...
java
public static void add(short magic, Class clazz) { if(magic < MIN_CUSTOM_MAGIC_NUMBER) throw new IllegalArgumentException("magic ID (" + magic + ") must be >= " + MIN_CUSTOM_MAGIC_NUMBER); if(magicMapUser.containsKey(magic) || classMap.containsKey(clazz)) alreadyInMagicMap(magic,...
[ "public", "static", "void", "add", "(", "short", "magic", ",", "Class", "clazz", ")", "{", "if", "(", "magic", "<", "MIN_CUSTOM_MAGIC_NUMBER", ")", "throw", "new", "IllegalArgumentException", "(", "\"magic ID (\"", "+", "magic", "+", "\") must be >= \"", "+", ...
Method to register a user-defined header with jg-magic-map at runtime @param magic The magic number. Needs to be > 1024 @param clazz The class. Usually a subclass of Header @throws IllegalArgumentException If the magic number is already taken, or the magic number is <= 1024
[ "Method", "to", "register", "a", "user", "-", "defined", "header", "with", "jg", "-", "magic", "-", "map", "at", "runtime" ]
bd3ca786aa57fed41dfbc10a94b1281e388be03b
https://github.com/belaban/JGroups/blob/bd3ca786aa57fed41dfbc10a94b1281e388be03b/src/org/jgroups/conf/ClassConfigurator.java#L71-L101
52,165
belaban/JGroups
src/org/jgroups/conf/ClassConfigurator.java
ClassConfigurator.get
public static Class get(String clazzname, ClassLoader loader) throws ClassNotFoundException { return Util.loadClass(clazzname, loader != null? loader : ClassConfigurator.class.getClassLoader()); }
java
public static Class get(String clazzname, ClassLoader loader) throws ClassNotFoundException { return Util.loadClass(clazzname, loader != null? loader : ClassConfigurator.class.getClassLoader()); }
[ "public", "static", "Class", "get", "(", "String", "clazzname", ",", "ClassLoader", "loader", ")", "throws", "ClassNotFoundException", "{", "return", "Util", ".", "loadClass", "(", "clazzname", ",", "loader", "!=", "null", "?", "loader", ":", "ClassConfigurator"...
Loads and returns the class from the class name @param clazzname a fully classified class name to be loaded @return a Class object that represents a class that implements java.io.Externalizable
[ "Loads", "and", "returns", "the", "class", "from", "the", "class", "name" ]
bd3ca786aa57fed41dfbc10a94b1281e388be03b
https://github.com/belaban/JGroups/blob/bd3ca786aa57fed41dfbc10a94b1281e388be03b/src/org/jgroups/conf/ClassConfigurator.java#L142-L144
52,166
belaban/JGroups
src/org/jgroups/conf/ClassConfigurator.java
ClassConfigurator.getMagicNumber
public static short getMagicNumber(Class clazz) { Short i=classMap.get(clazz); if(i == null) return -1; else return i; }
java
public static short getMagicNumber(Class clazz) { Short i=classMap.get(clazz); if(i == null) return -1; else return i; }
[ "public", "static", "short", "getMagicNumber", "(", "Class", "clazz", ")", "{", "Short", "i", "=", "classMap", ".", "get", "(", "clazz", ")", ";", "if", "(", "i", "==", "null", ")", "return", "-", "1", ";", "else", "return", "i", ";", "}" ]
Returns the magic number for the class. @param clazz a class object that we want the magic number for @return the magic number for a class, -1 if no mapping is available
[ "Returns", "the", "magic", "number", "for", "the", "class", "." ]
bd3ca786aa57fed41dfbc10a94b1281e388be03b
https://github.com/belaban/JGroups/blob/bd3ca786aa57fed41dfbc10a94b1281e388be03b/src/org/jgroups/conf/ClassConfigurator.java#L156-L162
52,167
belaban/JGroups
src/org/jgroups/protocols/pbcast/Merger.java
Merger.merge
public void merge(Map<Address, View> views) { if(views == null || views.isEmpty()) { log.warn("the views passed with the MERGE event were empty (or null); ignoring MERGE event"); return; } if(View.sameViews(views.values())) { log.debug("MERGE event is ignored...
java
public void merge(Map<Address, View> views) { if(views == null || views.isEmpty()) { log.warn("the views passed with the MERGE event were empty (or null); ignoring MERGE event"); return; } if(View.sameViews(views.values())) { log.debug("MERGE event is ignored...
[ "public", "void", "merge", "(", "Map", "<", "Address", ",", "View", ">", "views", ")", "{", "if", "(", "views", "==", "null", "||", "views", ".", "isEmpty", "(", ")", ")", "{", "log", ".", "warn", "(", "\"the views passed with the MERGE event were empty (o...
Invoked upon receiving a MERGE event from the MERGE layer. Starts the merge protocol. See description of protocol in DESIGN. @param views A List of <em>different</em> views detected by the merge protocol, keyed by sender
[ "Invoked", "upon", "receiving", "a", "MERGE", "event", "from", "the", "MERGE", "layer", ".", "Starts", "the", "merge", "protocol", ".", "See", "description", "of", "protocol", "in", "DESIGN", "." ]
bd3ca786aa57fed41dfbc10a94b1281e388be03b
https://github.com/belaban/JGroups/blob/bd3ca786aa57fed41dfbc10a94b1281e388be03b/src/org/jgroups/protocols/pbcast/Merger.java#L75-L101
52,168
belaban/JGroups
src/org/jgroups/protocols/pbcast/Merger.java
Merger.determineMergeLeader
protected Address determineMergeLeader(Map<Address,View> views) { // we need the merge *coordinators* not merge participants because not everyone can lead a merge ! Collection<Address> coords=Util.determineActualMergeCoords(views); if(coords.isEmpty()) coords=Util.determineMergeCoord...
java
protected Address determineMergeLeader(Map<Address,View> views) { // we need the merge *coordinators* not merge participants because not everyone can lead a merge ! Collection<Address> coords=Util.determineActualMergeCoords(views); if(coords.isEmpty()) coords=Util.determineMergeCoord...
[ "protected", "Address", "determineMergeLeader", "(", "Map", "<", "Address", ",", "View", ">", "views", ")", "{", "// we need the merge *coordinators* not merge participants because not everyone can lead a merge !", "Collection", "<", "Address", ">", "coords", "=", "Util", "...
Returns the address of the merge leader
[ "Returns", "the", "address", "of", "the", "merge", "leader" ]
bd3ca786aa57fed41dfbc10a94b1281e388be03b
https://github.com/belaban/JGroups/blob/bd3ca786aa57fed41dfbc10a94b1281e388be03b/src/org/jgroups/protocols/pbcast/Merger.java#L222-L232
52,169
belaban/JGroups
src/org/jgroups/protocols/pbcast/Merger.java
Merger.sendMergeResponse
protected void sendMergeResponse(Address sender, View view, Digest digest, MergeId merge_id) { Message msg=new Message(sender).setBuffer(GMS.marshal(view, digest)).setFlag(Message.Flag.OOB,Message.Flag.INTERNAL) .putHeader(gms.getId(), new GMS.GmsHeader(GMS.GmsHeader.MERGE_RSP).mergeId(merge_id)); ...
java
protected void sendMergeResponse(Address sender, View view, Digest digest, MergeId merge_id) { Message msg=new Message(sender).setBuffer(GMS.marshal(view, digest)).setFlag(Message.Flag.OOB,Message.Flag.INTERNAL) .putHeader(gms.getId(), new GMS.GmsHeader(GMS.GmsHeader.MERGE_RSP).mergeId(merge_id)); ...
[ "protected", "void", "sendMergeResponse", "(", "Address", "sender", ",", "View", "view", ",", "Digest", "digest", ",", "MergeId", "merge_id", ")", "{", "Message", "msg", "=", "new", "Message", "(", "sender", ")", ".", "setBuffer", "(", "GMS", ".", "marshal...
Send back a response containing view and digest to sender
[ "Send", "back", "a", "response", "containing", "view", "and", "digest", "to", "sender" ]
bd3ca786aa57fed41dfbc10a94b1281e388be03b
https://github.com/belaban/JGroups/blob/bd3ca786aa57fed41dfbc10a94b1281e388be03b/src/org/jgroups/protocols/pbcast/Merger.java#L300-L304
52,170
belaban/JGroups
src/org/jgroups/protocols/pbcast/Merger.java
Merger.sendMergeView
protected void sendMergeView(Collection<Address> coords, MergeData combined_merge_data, MergeId merge_id) { if(coords == null || coords.isEmpty() || combined_merge_data == null) return; View view=combined_merge_data.view; Digest digest=combined_merge_data.digest; if(view == ...
java
protected void sendMergeView(Collection<Address> coords, MergeData combined_merge_data, MergeId merge_id) { if(coords == null || coords.isEmpty() || combined_merge_data == null) return; View view=combined_merge_data.view; Digest digest=combined_merge_data.digest; if(view == ...
[ "protected", "void", "sendMergeView", "(", "Collection", "<", "Address", ">", "coords", ",", "MergeData", "combined_merge_data", ",", "MergeId", "merge_id", ")", "{", "if", "(", "coords", "==", "null", "||", "coords", ".", "isEmpty", "(", ")", "||", "combine...
Sends the new view and digest to all subgroup coordinators. Each coord will in turn broadcast the new view and digest to all the members of its subgroup
[ "Sends", "the", "new", "view", "and", "digest", "to", "all", "subgroup", "coordinators", ".", "Each", "coord", "will", "in", "turn", "broadcast", "the", "new", "view", "and", "digest", "to", "all", "the", "members", "of", "its", "subgroup" ]
bd3ca786aa57fed41dfbc10a94b1281e388be03b
https://github.com/belaban/JGroups/blob/bd3ca786aa57fed41dfbc10a94b1281e388be03b/src/org/jgroups/protocols/pbcast/Merger.java#L310-L350
52,171
belaban/JGroups
src/org/jgroups/protocols/pbcast/Merger.java
Merger.fixDigests
protected void fixDigests() { Digest digest=fetchDigestsFromAllMembersInSubPartition(gms.view, null); Message msg=new Message().putHeader(gms.getId(), new GMS.GmsHeader(GMS.GmsHeader.INSTALL_DIGEST)) .setBuffer(GMS.marshal(null, digest)); gms.getDownProtocol().down(msg); }
java
protected void fixDigests() { Digest digest=fetchDigestsFromAllMembersInSubPartition(gms.view, null); Message msg=new Message().putHeader(gms.getId(), new GMS.GmsHeader(GMS.GmsHeader.INSTALL_DIGEST)) .setBuffer(GMS.marshal(null, digest)); gms.getDownProtocol().down(msg); }
[ "protected", "void", "fixDigests", "(", ")", "{", "Digest", "digest", "=", "fetchDigestsFromAllMembersInSubPartition", "(", "gms", ".", "view", ",", "null", ")", ";", "Message", "msg", "=", "new", "Message", "(", ")", ".", "putHeader", "(", "gms", ".", "ge...
Fetches the digests from all members and installs them again. Used only for diagnosis and support; don't use this otherwise !
[ "Fetches", "the", "digests", "from", "all", "members", "and", "installs", "them", "again", ".", "Used", "only", "for", "diagnosis", "and", "support", ";", "don", "t", "use", "this", "otherwise", "!" ]
bd3ca786aa57fed41dfbc10a94b1281e388be03b
https://github.com/belaban/JGroups/blob/bd3ca786aa57fed41dfbc10a94b1281e388be03b/src/org/jgroups/protocols/pbcast/Merger.java#L416-L421
52,172
belaban/JGroups
src/org/jgroups/util/MutableDigest.java
MutableDigest.allSet
public boolean allSet() { for(int i=0; i < seqnos.length; i+=2) if(seqnos[i] == -1) return false; return true; }
java
public boolean allSet() { for(int i=0; i < seqnos.length; i+=2) if(seqnos[i] == -1) return false; return true; }
[ "public", "boolean", "allSet", "(", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "seqnos", ".", "length", ";", "i", "+=", "2", ")", "if", "(", "seqnos", "[", "i", "]", "==", "-", "1", ")", "return", "false", ";", "return", "true...
Returns true if all members have a corresponding seqno >= 0, else false
[ "Returns", "true", "if", "all", "members", "have", "a", "corresponding", "seqno", ">", "=", "0", "else", "false" ]
bd3ca786aa57fed41dfbc10a94b1281e388be03b
https://github.com/belaban/JGroups/blob/bd3ca786aa57fed41dfbc10a94b1281e388be03b/src/org/jgroups/util/MutableDigest.java#L37-L42
52,173
belaban/JGroups
src/org/jgroups/util/MutableDigest.java
MutableDigest.getNonSetMembers
public Address[] getNonSetMembers() { Address[] retval=new Address[countNonSetMembers()]; if(retval.length == 0) return retval; int index=0; for(int i=0; i < members.length; i++) if(seqnos[i*2] == -1) retval[index++]=members[i]; return retv...
java
public Address[] getNonSetMembers() { Address[] retval=new Address[countNonSetMembers()]; if(retval.length == 0) return retval; int index=0; for(int i=0; i < members.length; i++) if(seqnos[i*2] == -1) retval[index++]=members[i]; return retv...
[ "public", "Address", "[", "]", "getNonSetMembers", "(", ")", "{", "Address", "[", "]", "retval", "=", "new", "Address", "[", "countNonSetMembers", "(", ")", "]", ";", "if", "(", "retval", ".", "length", "==", "0", ")", "return", "retval", ";", "int", ...
Returns an array of members whose seqno is not set. Returns an empty array if all are set.
[ "Returns", "an", "array", "of", "members", "whose", "seqno", "is", "not", "set", ".", "Returns", "an", "empty", "array", "if", "all", "are", "set", "." ]
bd3ca786aa57fed41dfbc10a94b1281e388be03b
https://github.com/belaban/JGroups/blob/bd3ca786aa57fed41dfbc10a94b1281e388be03b/src/org/jgroups/util/MutableDigest.java#L45-L54
52,174
belaban/JGroups
src/org/jgroups/util/RequestTable.java
RequestTable.add
public long add(T element) { lock.lock(); try { long next=high+1; if(next - low > capacity()) _grow(next-low); int high_index=index(high); buffer[high_index]=element; return high++; } finally { lock.u...
java
public long add(T element) { lock.lock(); try { long next=high+1; if(next - low > capacity()) _grow(next-low); int high_index=index(high); buffer[high_index]=element; return high++; } finally { lock.u...
[ "public", "long", "add", "(", "T", "element", ")", "{", "lock", ".", "lock", "(", ")", ";", "try", "{", "long", "next", "=", "high", "+", "1", ";", "if", "(", "next", "-", "low", ">", "capacity", "(", ")", ")", "_grow", "(", "next", "-", "low...
Adds a new element and returns the sequence number at which it was inserted. Advances the high pointer and grows the buffer if needed. @param element the element to be added. Must not be null or an exception will be thrown @return the seqno at which element was added
[ "Adds", "a", "new", "element", "and", "returns", "the", "sequence", "number", "at", "which", "it", "was", "inserted", ".", "Advances", "the", "high", "pointer", "and", "grows", "the", "buffer", "if", "needed", "." ]
bd3ca786aa57fed41dfbc10a94b1281e388be03b
https://github.com/belaban/JGroups/blob/bd3ca786aa57fed41dfbc10a94b1281e388be03b/src/org/jgroups/util/RequestTable.java#L58-L71
52,175
belaban/JGroups
src/org/jgroups/util/RequestTable.java
RequestTable.remove
public T remove(long seqno) { lock.lock(); try { if(seqno < low || seqno > high) return null; int index=index(seqno); T retval=buffer[index]; if(retval != null && removes_till_compaction > 0) num_removes++; buffe...
java
public T remove(long seqno) { lock.lock(); try { if(seqno < low || seqno > high) return null; int index=index(seqno); T retval=buffer[index]; if(retval != null && removes_till_compaction > 0) num_removes++; buffe...
[ "public", "T", "remove", "(", "long", "seqno", ")", "{", "lock", ".", "lock", "(", ")", ";", "try", "{", "if", "(", "seqno", "<", "low", "||", "seqno", ">", "high", ")", "return", "null", ";", "int", "index", "=", "index", "(", "seqno", ")", ";...
Removes the element at the index matching seqno. If seqno == low, tries to advance low until a non-null element is encountered, up to high @param seqno @return
[ "Removes", "the", "element", "at", "the", "index", "matching", "seqno", ".", "If", "seqno", "==", "low", "tries", "to", "advance", "low", "until", "a", "non", "-", "null", "element", "is", "encountered", "up", "to", "high" ]
bd3ca786aa57fed41dfbc10a94b1281e388be03b
https://github.com/belaban/JGroups/blob/bd3ca786aa57fed41dfbc10a94b1281e388be03b/src/org/jgroups/util/RequestTable.java#L91-L112
52,176
belaban/JGroups
src/org/jgroups/util/RequestTable.java
RequestTable.grow
public RequestTable<T> grow(int new_capacity) { lock.lock(); try { _grow(new_capacity); return this; } finally { lock.unlock(); } }
java
public RequestTable<T> grow(int new_capacity) { lock.lock(); try { _grow(new_capacity); return this; } finally { lock.unlock(); } }
[ "public", "RequestTable", "<", "T", ">", "grow", "(", "int", "new_capacity", ")", "{", "lock", ".", "lock", "(", ")", ";", "try", "{", "_grow", "(", "new_capacity", ")", ";", "return", "this", ";", "}", "finally", "{", "lock", ".", "unlock", "(", "...
Grows the array to at least new_capacity. This method is mainly used for testing and is not typically called directly, but indirectly when adding elements and the underlying array has no space left. @param new_capacity the new capacity of the underlying array. Will be rounded up to the nearest power of 2 value. A value...
[ "Grows", "the", "array", "to", "at", "least", "new_capacity", ".", "This", "method", "is", "mainly", "used", "for", "testing", "and", "is", "not", "typically", "called", "directly", "but", "indirectly", "when", "adding", "elements", "and", "the", "underlying",...
bd3ca786aa57fed41dfbc10a94b1281e388be03b
https://github.com/belaban/JGroups/blob/bd3ca786aa57fed41dfbc10a94b1281e388be03b/src/org/jgroups/util/RequestTable.java#L221-L230
52,177
belaban/JGroups
src/org/jgroups/util/RequestTable.java
RequestTable._compact
@GuardedBy("lock") protected boolean _compact() { int new_cap=buffer.length >> 1; // needs to be a power of 2 for efficient modulo operation, e.g. for index() // boolean compactable=this.buffer.length > 0 && (size() <= new_cap || (contiguousSpaceAvailable=_contiguousSpaceAvailable(new_cap))); ...
java
@GuardedBy("lock") protected boolean _compact() { int new_cap=buffer.length >> 1; // needs to be a power of 2 for efficient modulo operation, e.g. for index() // boolean compactable=this.buffer.length > 0 && (size() <= new_cap || (contiguousSpaceAvailable=_contiguousSpaceAvailable(new_cap))); ...
[ "@", "GuardedBy", "(", "\"lock\"", ")", "protected", "boolean", "_compact", "(", ")", "{", "int", "new_cap", "=", "buffer", ".", "length", ">>", "1", ";", "// needs to be a power of 2 for efficient modulo operation, e.g. for index()", "// boolean compactable=this.buffer.len...
Shrinks the array to half of its current size if the current number of elements fit into half of the capacity. @return true if the compaction succeeded, else false (e.g. when the current elements would not fit)
[ "Shrinks", "the", "array", "to", "half", "of", "its", "current", "size", "if", "the", "current", "number", "of", "elements", "fit", "into", "half", "of", "the", "capacity", "." ]
bd3ca786aa57fed41dfbc10a94b1281e388be03b
https://github.com/belaban/JGroups/blob/bd3ca786aa57fed41dfbc10a94b1281e388be03b/src/org/jgroups/util/RequestTable.java#L289-L298
52,178
belaban/JGroups
src/org/jgroups/util/RequestTable.java
RequestTable._copy
protected void _copy(int new_cap) { // copy elements from [low to high-1] into new indices in new array T[] new_buf=(T[])new Object[new_cap]; int new_len=new_buf.length; int old_len=this.buffer.length; for(long i=low, num_iterations=0; i < high && num_iterations < old_len; i++, ...
java
protected void _copy(int new_cap) { // copy elements from [low to high-1] into new indices in new array T[] new_buf=(T[])new Object[new_cap]; int new_len=new_buf.length; int old_len=this.buffer.length; for(long i=low, num_iterations=0; i < high && num_iterations < old_len; i++, ...
[ "protected", "void", "_copy", "(", "int", "new_cap", ")", "{", "// copy elements from [low to high-1] into new indices in new array", "T", "[", "]", "new_buf", "=", "(", "T", "[", "]", ")", "new", "Object", "[", "new_cap", "]", ";", "int", "new_len", "=", "new...
Copies elements from old into new array
[ "Copies", "elements", "from", "old", "into", "new", "array" ]
bd3ca786aa57fed41dfbc10a94b1281e388be03b
https://github.com/belaban/JGroups/blob/bd3ca786aa57fed41dfbc10a94b1281e388be03b/src/org/jgroups/util/RequestTable.java#L323-L337
52,179
belaban/JGroups
src/org/jgroups/util/SizeBoundedQueue.java
SizeBoundedQueue.remove
public T remove() { lock.lock(); try { if(queue.isEmpty()) return null; El<T> el=queue.poll(); count-=el.size; not_full.signalAll(); return el.el; } finally { lock.unlock(); } }
java
public T remove() { lock.lock(); try { if(queue.isEmpty()) return null; El<T> el=queue.poll(); count-=el.size; not_full.signalAll(); return el.el; } finally { lock.unlock(); } }
[ "public", "T", "remove", "(", ")", "{", "lock", ".", "lock", "(", ")", ";", "try", "{", "if", "(", "queue", ".", "isEmpty", "(", ")", ")", "return", "null", ";", "El", "<", "T", ">", "el", "=", "queue", ".", "poll", "(", ")", ";", "count", ...
Removes and returns the first element or null if the queue is empty
[ "Removes", "and", "returns", "the", "first", "element", "or", "null", "if", "the", "queue", "is", "empty" ]
bd3ca786aa57fed41dfbc10a94b1281e388be03b
https://github.com/belaban/JGroups/blob/bd3ca786aa57fed41dfbc10a94b1281e388be03b/src/org/jgroups/util/SizeBoundedQueue.java#L67-L81
52,180
belaban/JGroups
src/org/jgroups/protocols/tom/SenderManager.java
SenderManager.addNewMessageToSend
public void addNewMessageToSend(MessageID messageID, Collection<Address> destinations, long initialSequenceNumber, boolean deliverToMyself) { MessageInfo messageInfo = new MessageInfo(destinations, initialSequenceNumber, deliverToMyself); if (deliverToMyself) { ...
java
public void addNewMessageToSend(MessageID messageID, Collection<Address> destinations, long initialSequenceNumber, boolean deliverToMyself) { MessageInfo messageInfo = new MessageInfo(destinations, initialSequenceNumber, deliverToMyself); if (deliverToMyself) { ...
[ "public", "void", "addNewMessageToSend", "(", "MessageID", "messageID", ",", "Collection", "<", "Address", ">", "destinations", ",", "long", "initialSequenceNumber", ",", "boolean", "deliverToMyself", ")", "{", "MessageInfo", "messageInfo", "=", "new", "MessageInfo", ...
Add a new message sent @param messageID the message ID @param destinations the destination set @param initialSequenceNumber the initial sequence number @param deliverToMyself true if *this* member is in destination sent, false otherwise
[ "Add", "a", "new", "message", "sent" ]
bd3ca786aa57fed41dfbc10a94b1281e388be03b
https://github.com/belaban/JGroups/blob/bd3ca786aa57fed41dfbc10a94b1281e388be03b/src/org/jgroups/protocols/tom/SenderManager.java#L28-L35
52,181
belaban/JGroups
src/org/jgroups/protocols/tom/SenderManager.java
SenderManager.addPropose
public long addPropose(MessageID messageID, Address from, long sequenceNumber) { MessageInfo messageInfo = sentMessages.get(messageID); if (messageInfo != null && messageInfo.addPropose(from, sequenceNumber)) { return messageInfo.getAndMarkFinalSent(); } return NOT_READY; ...
java
public long addPropose(MessageID messageID, Address from, long sequenceNumber) { MessageInfo messageInfo = sentMessages.get(messageID); if (messageInfo != null && messageInfo.addPropose(from, sequenceNumber)) { return messageInfo.getAndMarkFinalSent(); } return NOT_READY; ...
[ "public", "long", "addPropose", "(", "MessageID", "messageID", ",", "Address", "from", ",", "long", "sequenceNumber", ")", "{", "MessageInfo", "messageInfo", "=", "sentMessages", ".", "get", "(", "messageID", ")", ";", "if", "(", "messageInfo", "!=", "null", ...
Add a propose from a member in destination set @param messageID the message ID @param from the originator of the propose @param sequenceNumber the proposed sequence number @return NOT_READY if the final sequence number is not know, or the final sequence number
[ "Add", "a", "propose", "from", "a", "member", "in", "destination", "set" ]
bd3ca786aa57fed41dfbc10a94b1281e388be03b
https://github.com/belaban/JGroups/blob/bd3ca786aa57fed41dfbc10a94b1281e388be03b/src/org/jgroups/protocols/tom/SenderManager.java#L44-L50
52,182
belaban/JGroups
src/org/jgroups/protocols/tom/SenderManager.java
SenderManager.markSent
public boolean markSent(MessageID messageID) { MessageInfo messageInfo = sentMessages.remove(messageID); return messageInfo != null && messageInfo.toSelfDeliver; }
java
public boolean markSent(MessageID messageID) { MessageInfo messageInfo = sentMessages.remove(messageID); return messageInfo != null && messageInfo.toSelfDeliver; }
[ "public", "boolean", "markSent", "(", "MessageID", "messageID", ")", "{", "MessageInfo", "messageInfo", "=", "sentMessages", ".", "remove", "(", "messageID", ")", ";", "return", "messageInfo", "!=", "null", "&&", "messageInfo", ".", "toSelfDeliver", ";", "}" ]
Mark the message as sent @param messageID the message ID @return return true if *this* member is in destination set
[ "Mark", "the", "message", "as", "sent" ]
bd3ca786aa57fed41dfbc10a94b1281e388be03b
https://github.com/belaban/JGroups/blob/bd3ca786aa57fed41dfbc10a94b1281e388be03b/src/org/jgroups/protocols/tom/SenderManager.java#L57-L60
52,183
belaban/JGroups
src/org/jgroups/protocols/tom/SenderManager.java
SenderManager.getDestination
public Set<Address> getDestination(MessageID messageID) { MessageInfo messageInfo = sentMessages.get(messageID); Set<Address> destination; if (messageInfo != null) { destination = new HashSet<>(messageInfo.destinations); } else { destination = Collections.emptySet...
java
public Set<Address> getDestination(MessageID messageID) { MessageInfo messageInfo = sentMessages.get(messageID); Set<Address> destination; if (messageInfo != null) { destination = new HashSet<>(messageInfo.destinations); } else { destination = Collections.emptySet...
[ "public", "Set", "<", "Address", ">", "getDestination", "(", "MessageID", "messageID", ")", "{", "MessageInfo", "messageInfo", "=", "sentMessages", ".", "get", "(", "messageID", ")", ";", "Set", "<", "Address", ">", "destination", ";", "if", "(", "messageInf...
obtains the destination set of a message @param messageID the message ID @return the destination set
[ "obtains", "the", "destination", "set", "of", "a", "message" ]
bd3ca786aa57fed41dfbc10a94b1281e388be03b
https://github.com/belaban/JGroups/blob/bd3ca786aa57fed41dfbc10a94b1281e388be03b/src/org/jgroups/protocols/tom/SenderManager.java#L67-L76
52,184
belaban/JGroups
src/org/jgroups/util/Average.java
Average.merge
public <T extends Average> T merge(T other) { if(Util.productGreaterThan(count, (long)Math.ceil(avg), Long.MAX_VALUE) || Util.productGreaterThan(other.count(), (long)Math.ceil(other.average()), Long.MAX_VALUE)) { // the above computation is not correct as the sum of the 2 products can stil...
java
public <T extends Average> T merge(T other) { if(Util.productGreaterThan(count, (long)Math.ceil(avg), Long.MAX_VALUE) || Util.productGreaterThan(other.count(), (long)Math.ceil(other.average()), Long.MAX_VALUE)) { // the above computation is not correct as the sum of the 2 products can stil...
[ "public", "<", "T", "extends", "Average", ">", "T", "merge", "(", "T", "other", ")", "{", "if", "(", "Util", ".", "productGreaterThan", "(", "count", ",", "(", "long", ")", "Math", ".", "ceil", "(", "avg", ")", ",", "Long", ".", "MAX_VALUE", ")", ...
Merges this average with another one
[ "Merges", "this", "average", "with", "another", "one" ]
bd3ca786aa57fed41dfbc10a94b1281e388be03b
https://github.com/belaban/JGroups/blob/bd3ca786aa57fed41dfbc10a94b1281e388be03b/src/org/jgroups/util/Average.java#L36-L49
52,185
belaban/JGroups
src/org/jgroups/util/SeqnoRange.java
SeqnoRange.getBits
public Collection<Range> getBits(boolean value) { int index=0; int start_range=0, end_range=0; int size=(int)((high - low) + 1); final Collection<Range> retval=new ArrayList<>(size); while(index < size) { start_range=value? bits.nextSetBit(index) : bits.nextClearBit(...
java
public Collection<Range> getBits(boolean value) { int index=0; int start_range=0, end_range=0; int size=(int)((high - low) + 1); final Collection<Range> retval=new ArrayList<>(size); while(index < size) { start_range=value? bits.nextSetBit(index) : bits.nextClearBit(...
[ "public", "Collection", "<", "Range", ">", "getBits", "(", "boolean", "value", ")", "{", "int", "index", "=", "0", ";", "int", "start_range", "=", "0", ",", "end_range", "=", "0", ";", "int", "size", "=", "(", "int", ")", "(", "(", "high", "-", "...
Returns ranges of all bit set to value @param value If true, returns all bits set to 1, else 0 @return
[ "Returns", "ranges", "of", "all", "bit", "set", "to", "value" ]
bd3ca786aa57fed41dfbc10a94b1281e388be03b
https://github.com/belaban/JGroups/blob/bd3ca786aa57fed41dfbc10a94b1281e388be03b/src/org/jgroups/util/SeqnoRange.java#L115-L135
52,186
belaban/JGroups
src/org/jgroups/protocols/rules/SUPERVISOR.java
SUPERVISOR.installRule
public void installRule(String name, long interval, Rule rule) { rule.supervisor(this).log(log).init(); Future<?> future=timer.scheduleAtFixedRate(rule, interval, interval, TimeUnit.MILLISECONDS); Tuple<Rule,Future<?>> existing=rules.put(name != null? name : rule.name(), new Tuple<>(rule, future...
java
public void installRule(String name, long interval, Rule rule) { rule.supervisor(this).log(log).init(); Future<?> future=timer.scheduleAtFixedRate(rule, interval, interval, TimeUnit.MILLISECONDS); Tuple<Rule,Future<?>> existing=rules.put(name != null? name : rule.name(), new Tuple<>(rule, future...
[ "public", "void", "installRule", "(", "String", "name", ",", "long", "interval", ",", "Rule", "rule", ")", "{", "rule", ".", "supervisor", "(", "this", ")", ".", "log", "(", "log", ")", ".", "init", "(", ")", ";", "Future", "<", "?", ">", "future",...
Installs a new rule @param name The name of the rule @param interval Number of ms between executions of the rule @param rule The rule
[ "Installs", "a", "new", "rule" ]
bd3ca786aa57fed41dfbc10a94b1281e388be03b
https://github.com/belaban/JGroups/blob/bd3ca786aa57fed41dfbc10a94b1281e388be03b/src/org/jgroups/protocols/rules/SUPERVISOR.java#L139-L145
52,187
belaban/JGroups
src/org/jgroups/protocols/pbcast/STATE_TRANSFER.java
STATE_TRANSFER.handleStateRsp
protected void handleStateRsp(final Digest digest, Address sender, byte[] state) { try { if(isDigestNeeded()) { punchHoleFor(sender); closeBarrierAndSuspendStable(); // fix for https://jira.jboss.org/jira/browse/JGRP-1013 if(digest != null) ...
java
protected void handleStateRsp(final Digest digest, Address sender, byte[] state) { try { if(isDigestNeeded()) { punchHoleFor(sender); closeBarrierAndSuspendStable(); // fix for https://jira.jboss.org/jira/browse/JGRP-1013 if(digest != null) ...
[ "protected", "void", "handleStateRsp", "(", "final", "Digest", "digest", ",", "Address", "sender", ",", "byte", "[", "]", "state", ")", "{", "try", "{", "if", "(", "isDigestNeeded", "(", ")", ")", "{", "punchHoleFor", "(", "sender", ")", ";", "closeBarri...
Set the digest and the send the state up to the application
[ "Set", "the", "digest", "and", "the", "send", "the", "state", "up", "to", "the", "application" ]
bd3ca786aa57fed41dfbc10a94b1281e388be03b
https://github.com/belaban/JGroups/blob/bd3ca786aa57fed41dfbc10a94b1281e388be03b/src/org/jgroups/protocols/pbcast/STATE_TRANSFER.java#L358-L383
52,188
belaban/JGroups
src/org/jgroups/protocols/RingBufferBundlerLockless.java
RingBufferBundlerLockless.advanceWriteIndex
protected int advanceWriteIndex() { int num=0, start=write_index; for(;;) { if(buf[start] == null) break; num++; start=index(start+1); if(start == tmp_write_index.get()) break; } write_index=start; re...
java
protected int advanceWriteIndex() { int num=0, start=write_index; for(;;) { if(buf[start] == null) break; num++; start=index(start+1); if(start == tmp_write_index.get()) break; } write_index=start; re...
[ "protected", "int", "advanceWriteIndex", "(", ")", "{", "int", "num", "=", "0", ",", "start", "=", "write_index", ";", "for", "(", ";", ";", ")", "{", "if", "(", "buf", "[", "start", "]", "==", "null", ")", "break", ";", "num", "++", ";", "start"...
Advance write_index up to tmp_write_index as long as no null msg is found
[ "Advance", "write_index", "up", "to", "tmp_write_index", "as", "long", "as", "no", "null", "msg", "is", "found" ]
bd3ca786aa57fed41dfbc10a94b1281e388be03b
https://github.com/belaban/JGroups/blob/bd3ca786aa57fed41dfbc10a94b1281e388be03b/src/org/jgroups/protocols/RingBufferBundlerLockless.java#L132-L144
52,189
belaban/JGroups
src/org/jgroups/demos/TotalOrder.java
MyCanvas.drawEmptyBoard
void drawEmptyBoard(Graphics g) { int x=x_offset, y=y_offset; Color old_col=g.getColor(); g.setFont(def_font2); old_col=g.getColor(); g.setColor(checksum_col); g.drawString(("Checksum: " + checksum), x_offset + field_size, y_offset - 20); g.setFont(def_font); ...
java
void drawEmptyBoard(Graphics g) { int x=x_offset, y=y_offset; Color old_col=g.getColor(); g.setFont(def_font2); old_col=g.getColor(); g.setColor(checksum_col); g.drawString(("Checksum: " + checksum), x_offset + field_size, y_offset - 20); g.setFont(def_font); ...
[ "void", "drawEmptyBoard", "(", "Graphics", "g", ")", "{", "int", "x", "=", "x_offset", ",", "y", "=", "y_offset", ";", "Color", "old_col", "=", "g", ".", "getColor", "(", ")", ";", "g", ".", "setFont", "(", "def_font2", ")", ";", "old_col", "=", "g...
Draws the empty board, no pieces on it yet, just grid lines
[ "Draws", "the", "empty", "board", "no", "pieces", "on", "it", "yet", "just", "grid", "lines" ]
bd3ca786aa57fed41dfbc10a94b1281e388be03b
https://github.com/belaban/JGroups/blob/bd3ca786aa57fed41dfbc10a94b1281e388be03b/src/org/jgroups/demos/TotalOrder.java#L626-L650
52,190
belaban/JGroups
src/org/jgroups/protocols/pbcast/FLUSH.java
FLUSH.onSuspend
private void onSuspend(final List<Address> members) { Message msg = null; Collection<Address> participantsInFlush = null; synchronized (sharedLock) { flushCoordinator = localAddress; // start FLUSH only on group members that we need to flush participantsInFlush...
java
private void onSuspend(final List<Address> members) { Message msg = null; Collection<Address> participantsInFlush = null; synchronized (sharedLock) { flushCoordinator = localAddress; // start FLUSH only on group members that we need to flush participantsInFlush...
[ "private", "void", "onSuspend", "(", "final", "List", "<", "Address", ">", "members", ")", "{", "Message", "msg", "=", "null", ";", "Collection", "<", "Address", ">", "participantsInFlush", "=", "null", ";", "synchronized", "(", "sharedLock", ")", "{", "fl...
Starts the flush protocol @param members List of participants in the flush protocol. Guaranteed to be non-null
[ "Starts", "the", "flush", "protocol" ]
bd3ca786aa57fed41dfbc10a94b1281e388be03b
https://github.com/belaban/JGroups/blob/bd3ca786aa57fed41dfbc10a94b1281e388be03b/src/org/jgroups/protocols/pbcast/FLUSH.java#L688-L713
52,191
belaban/JGroups
src/org/jgroups/protocols/pbcast/FLUSH.java
FLUSH.maxSeqnos
protected static Digest maxSeqnos(final View view, List<Digest> digests) { if(view == null || digests == null) return null; MutableDigest digest=new MutableDigest(view.getMembersRaw()); digests.forEach(digest::merge); return digest; }
java
protected static Digest maxSeqnos(final View view, List<Digest> digests) { if(view == null || digests == null) return null; MutableDigest digest=new MutableDigest(view.getMembersRaw()); digests.forEach(digest::merge); return digest; }
[ "protected", "static", "Digest", "maxSeqnos", "(", "final", "View", "view", ",", "List", "<", "Digest", ">", "digests", ")", "{", "if", "(", "view", "==", "null", "||", "digests", "==", "null", ")", "return", "null", ";", "MutableDigest", "digest", "=", ...
Returns a digest which contains, for all members of view, the highest delivered and received seqno of all digests
[ "Returns", "a", "digest", "which", "contains", "for", "all", "members", "of", "view", "the", "highest", "delivered", "and", "received", "seqno", "of", "all", "digests" ]
bd3ca786aa57fed41dfbc10a94b1281e388be03b
https://github.com/belaban/JGroups/blob/bd3ca786aa57fed41dfbc10a94b1281e388be03b/src/org/jgroups/protocols/pbcast/FLUSH.java#L872-L879
52,192
belaban/JGroups
src/org/jgroups/stack/LargestWinningPolicy.java
LargestWinningPolicy.getNewMembership
public List<Address> getNewMembership(final Collection<Collection<Address>> subviews) { ArrayList<Collection<Address>> aSubviews=new ArrayList<>(subviews); int sLargest = 0; int iLargest = 0; for (int i = 0; i < aSubviews.size(); i++) { int size = aSubviews.get(i).size(); ...
java
public List<Address> getNewMembership(final Collection<Collection<Address>> subviews) { ArrayList<Collection<Address>> aSubviews=new ArrayList<>(subviews); int sLargest = 0; int iLargest = 0; for (int i = 0; i < aSubviews.size(); i++) { int size = aSubviews.get(i).size(); ...
[ "public", "List", "<", "Address", ">", "getNewMembership", "(", "final", "Collection", "<", "Collection", "<", "Address", ">", ">", "subviews", ")", "{", "ArrayList", "<", "Collection", "<", "Address", ">>", "aSubviews", "=", "new", "ArrayList", "<>", "(", ...
Called when a merge happened. The largest subview wins.
[ "Called", "when", "a", "merge", "happened", ".", "The", "largest", "subview", "wins", "." ]
bd3ca786aa57fed41dfbc10a94b1281e388be03b
https://github.com/belaban/JGroups/blob/bd3ca786aa57fed41dfbc10a94b1281e388be03b/src/org/jgroups/stack/LargestWinningPolicy.java#L22-L41
52,193
belaban/JGroups
src/org/jgroups/blocks/cs/TcpConnection.java
TcpConnection.sendLocalAddress
protected void sendLocalAddress(Address local_addr) throws Exception { try { // write the cookie out.write(cookie, 0, cookie.length); // write the version out.writeShort(Version.version); out.writeShort(local_addr.serializedSize()); // address size ...
java
protected void sendLocalAddress(Address local_addr) throws Exception { try { // write the cookie out.write(cookie, 0, cookie.length); // write the version out.writeShort(Version.version); out.writeShort(local_addr.serializedSize()); // address size ...
[ "protected", "void", "sendLocalAddress", "(", "Address", "local_addr", ")", "throws", "Exception", "{", "try", "{", "// write the cookie", "out", ".", "write", "(", "cookie", ",", "0", ",", "cookie", ".", "length", ")", ";", "// write the version", "out", ".",...
Send the cookie first, then the our port number. If the cookie doesn't match the receiver's cookie, the receiver will reject the connection and close it.
[ "Send", "the", "cookie", "first", "then", "the", "our", "port", "number", ".", "If", "the", "cookie", "doesn", "t", "match", "the", "receiver", "s", "cookie", "the", "receiver", "will", "reject", "the", "connection", "and", "close", "it", "." ]
bd3ca786aa57fed41dfbc10a94b1281e388be03b
https://github.com/belaban/JGroups/blob/bd3ca786aa57fed41dfbc10a94b1281e388be03b/src/org/jgroups/blocks/cs/TcpConnection.java#L215-L232
52,194
belaban/JGroups
src/org/jgroups/blocks/cs/TcpConnection.java
TcpConnection.readPeerAddress
protected Address readPeerAddress(Socket client_sock) throws Exception { int timeout=client_sock.getSoTimeout(); client_sock.setSoTimeout(server.peerAddressReadTimeout()); try { // read the cookie first byte[] input_cookie=new byte[cookie.length]; in.readFull...
java
protected Address readPeerAddress(Socket client_sock) throws Exception { int timeout=client_sock.getSoTimeout(); client_sock.setSoTimeout(server.peerAddressReadTimeout()); try { // read the cookie first byte[] input_cookie=new byte[cookie.length]; in.readFull...
[ "protected", "Address", "readPeerAddress", "(", "Socket", "client_sock", ")", "throws", "Exception", "{", "int", "timeout", "=", "client_sock", ".", "getSoTimeout", "(", ")", ";", "client_sock", ".", "setSoTimeout", "(", "server", ".", "peerAddressReadTimeout", "(...
Reads the peer's address. First a cookie has to be sent which has to match my own cookie, otherwise the connection will be refused
[ "Reads", "the", "peer", "s", "address", ".", "First", "a", "cookie", "has", "to", "be", "sent", "which", "has", "to", "match", "my", "own", "cookie", "otherwise", "the", "connection", "will", "be", "refused" ]
bd3ca786aa57fed41dfbc10a94b1281e388be03b
https://github.com/belaban/JGroups/blob/bd3ca786aa57fed41dfbc10a94b1281e388be03b/src/org/jgroups/blocks/cs/TcpConnection.java#L238-L266
52,195
belaban/JGroups
src/org/jgroups/jmx/JmxConfigurator.java
JmxConfigurator.unregister
public static void unregister(MBeanServer server, String object_name) throws Exception { Set<ObjectName> mbeans = server.queryNames(new ObjectName(object_name), null); if(mbeans != null) for (ObjectName name: mbeans) server.unregisterMBean(name); }
java
public static void unregister(MBeanServer server, String object_name) throws Exception { Set<ObjectName> mbeans = server.queryNames(new ObjectName(object_name), null); if(mbeans != null) for (ObjectName name: mbeans) server.unregisterMBean(name); }
[ "public", "static", "void", "unregister", "(", "MBeanServer", "server", ",", "String", "object_name", ")", "throws", "Exception", "{", "Set", "<", "ObjectName", ">", "mbeans", "=", "server", ".", "queryNames", "(", "new", "ObjectName", "(", "object_name", ")",...
Unregisters object_name and everything under it @param object_name
[ "Unregisters", "object_name", "and", "everything", "under", "it" ]
bd3ca786aa57fed41dfbc10a94b1281e388be03b
https://github.com/belaban/JGroups/blob/bd3ca786aa57fed41dfbc10a94b1281e388be03b/src/org/jgroups/jmx/JmxConfigurator.java#L224-L229
52,196
belaban/JGroups
src/org/jgroups/Channel.java
Channel.send
public void send(Address dst, byte[] buf, int offset, int length) throws Exception { ch.send(dst, buf, offset, length); }
java
public void send(Address dst, byte[] buf, int offset, int length) throws Exception { ch.send(dst, buf, offset, length); }
[ "public", "void", "send", "(", "Address", "dst", ",", "byte", "[", "]", "buf", ",", "int", "offset", ",", "int", "length", ")", "throws", "Exception", "{", "ch", ".", "send", "(", "dst", ",", "buf", ",", "offset", ",", "length", ")", ";", "}" ]
Sends a message to a destination. @param dst The destination address. If null, the message will be sent to all cluster nodes (= group members) @param buf The buffer to be sent @param offset The offset into the buffer @param length The length of the data to be sent. Has to be <= buf.length - offset. This will send <cod...
[ "Sends", "a", "message", "to", "a", "destination", "." ]
bd3ca786aa57fed41dfbc10a94b1281e388be03b
https://github.com/belaban/JGroups/blob/bd3ca786aa57fed41dfbc10a94b1281e388be03b/src/org/jgroups/Channel.java#L263-L265
52,197
belaban/JGroups
src/org/jgroups/Channel.java
Channel.down
public Object down(Event evt) { if(evt.type() == 1) // MSG return ch.down((Message)evt.getArg()); return ch.down(evt); }
java
public Object down(Event evt) { if(evt.type() == 1) // MSG return ch.down((Message)evt.getArg()); return ch.down(evt); }
[ "public", "Object", "down", "(", "Event", "evt", ")", "{", "if", "(", "evt", ".", "type", "(", ")", "==", "1", ")", "// MSG", "return", "ch", ".", "down", "(", "(", "Message", ")", "evt", ".", "getArg", "(", ")", ")", ";", "return", "ch", ".", ...
Enables access to event mechanism of a channel and is normally not used by clients directly. @param evt sends an Event to a specific protocol layer and receives a response. @return a response from a particular protocol layer targeted by Event parameter
[ "Enables", "access", "to", "event", "mechanism", "of", "a", "channel", "and", "is", "normally", "not", "used", "by", "clients", "directly", "." ]
bd3ca786aa57fed41dfbc10a94b1281e388be03b
https://github.com/belaban/JGroups/blob/bd3ca786aa57fed41dfbc10a94b1281e388be03b/src/org/jgroups/Channel.java#L274-L278
52,198
belaban/JGroups
src/org/jgroups/util/SuppressCache.java
SuppressCache.putIfAbsent
public Value putIfAbsent(T key, long expiry_time) { if(key == null) key=NULL_KEY; Value val=map.get(key); if(val == null) { val=new Value(); Value existing=map.putIfAbsent(key, val); if(existing == null) return val; val=...
java
public Value putIfAbsent(T key, long expiry_time) { if(key == null) key=NULL_KEY; Value val=map.get(key); if(val == null) { val=new Value(); Value existing=map.putIfAbsent(key, val); if(existing == null) return val; val=...
[ "public", "Value", "putIfAbsent", "(", "T", "key", ",", "long", "expiry_time", ")", "{", "if", "(", "key", "==", "null", ")", "key", "=", "NULL_KEY", ";", "Value", "val", "=", "map", ".", "get", "(", "key", ")", ";", "if", "(", "val", "==", "null...
Adds a new key to the hashmap, or updates the Value associated with the existing key if present. If expiry_time is greater than the age of the Value, the key will be removed. @param key The key @param expiry_time Expiry time (in ms) @return Null if the key was present and not expired, or the Value associated with the e...
[ "Adds", "a", "new", "key", "to", "the", "hashmap", "or", "updates", "the", "Value", "associated", "with", "the", "existing", "key", "if", "present", ".", "If", "expiry_time", "is", "greater", "than", "the", "age", "of", "the", "Value", "the", "key", "wil...
bd3ca786aa57fed41dfbc10a94b1281e388be03b
https://github.com/belaban/JGroups/blob/bd3ca786aa57fed41dfbc10a94b1281e388be03b/src/org/jgroups/util/SuppressCache.java#L29-L47
52,199
belaban/JGroups
src/org/jgroups/util/SuppressCache.java
SuppressCache.size
public int size() { int count=0; for(Value val: map.values()) count+=val.count(); return count; }
java
public int size() { int count=0; for(Value val: map.values()) count+=val.count(); return count; }
[ "public", "int", "size", "(", ")", "{", "int", "count", "=", "0", ";", "for", "(", "Value", "val", ":", "map", ".", "values", "(", ")", ")", "count", "+=", "val", ".", "count", "(", ")", ";", "return", "count", ";", "}" ]
Returns the total count of all values
[ "Returns", "the", "total", "count", "of", "all", "values" ]
bd3ca786aa57fed41dfbc10a94b1281e388be03b
https://github.com/belaban/JGroups/blob/bd3ca786aa57fed41dfbc10a94b1281e388be03b/src/org/jgroups/util/SuppressCache.java#L66-L72