id
stringlengths
7
14
text
stringlengths
1
106k
160996_65
public void alloc( int k ) { if (k == 0) throw new IllegalArgumentException( "k == 0" ); int newAlloc = alloc + k; if (newAlloc > limit) throw new IllegalStateException( "newAlloc > limit" ); if (newAlloc < 0) throw new IllegalStateException( "newAlloc < 0" ); alloc = newAlloc; }
160996_66
public void alloc( int k ) { if (k == 0) throw new IllegalArgumentException( "k == 0" ); int newAlloc = alloc + k; if (newAlloc > limit) throw new IllegalStateException( "newAlloc > limit" ); if (newAlloc < 0) throw new IllegalStateException( "newAlloc < 0" ); alloc = newAlloc; }
160996_67
public void alloc( int k ) { if (k == 0) throw new IllegalArgumentException( "k == 0" ); int newAlloc = alloc + k; if (newAlloc > limit) throw new IllegalStateException( "newAlloc > limit" ); if (newAlloc < 0) throw new IllegalStateException( "newAlloc < 0" ); alloc = newAlloc; }
160996_68
public SessionData getSession() { return session; }
160996_69
void stop() throws IOException { started = false; MyAcceptHandler h = setHandler( null ); if (h != null) { h.cancel(); } }
160996_70
public int size() { return size; }
160996_71
public int size() { return size; }
160996_72
public int size() { return size; }
160996_73
public T get() throws InterruptedException { return get( 0 ); }
160996_74
public boolean put( T obj ) throws InterruptedException { return put( obj, 0 ); }
160996_75
final private void checkBuf( byte[] buf, int off, int len ) { if (buf == null) throw new NullPointerException( "buf == null" ); if (off < 0 || off > buf.length) throw new IllegalArgumentException( "off < 0 || off > buf.length" ); if (len < 0) throw new IllegalArgumentException( "len < 0" ); if (off+len ...
160996_76
final private void checkBuf( byte[] buf, int off, int len ) { if (buf == null) throw new NullPointerException( "buf == null" ); if (off < 0 || off > buf.length) throw new IllegalArgumentException( "off < 0 || off > buf.length" ); if (len < 0) throw new IllegalArgumentException( "len < 0" ); if (off+len ...
160996_77
final private void checkBuf( byte[] buf, int off, int len ) { if (buf == null) throw new NullPointerException( "buf == null" ); if (off < 0 || off > buf.length) throw new IllegalArgumentException( "off < 0 || off > buf.length" ); if (len < 0) throw new IllegalArgumentException( "len < 0" ); if (off+len ...
160996_78
final private void checkBuf( byte[] buf, int off, int len ) { if (buf == null) throw new NullPointerException( "buf == null" ); if (off < 0 || off > buf.length) throw new IllegalArgumentException( "off < 0 || off > buf.length" ); if (len < 0) throw new IllegalArgumentException( "len < 0" ); if (off+len ...
160996_79
final public FlexBuffer setLength( int length ) throws IllegalArgumentException, IOException { if (length < 0) throw new IllegalArgumentException( "length < 0" ); ensureLength( length ); this.length = length; if (index > length) index = length; return this; }
160996_80
final public FlexBuffer setIndex( int index ) throws IllegalArgumentException { if (index < 0 || index > length) throw new IllegalArgumentException( "index < 0 || index > length" ); this.index = index; return this; }
160996_81
final public FlexBuffer setIndex( int index ) throws IllegalArgumentException { if (index < 0 || index > length) throw new IllegalArgumentException( "index < 0 || index > length" ); this.index = index; return this; }
160996_82
final public FlexBuffer reset() { index = 0; length = 0; if (buffer.length > TRIM_BUFFER_LEN) buffer = new byte[TRIM_BUFFER_LEN]; return this; }
160996_83
final public int get() throws IOException { checkAvail( 1 ); return buffer[index++] & 255; }
160996_84
final public FlexBuffer compact() { if (index == 0) return this; int n = avail(); if (n == 0) { reset(); return this; } System.arraycopy( buffer, index, buffer, 0, n ); index = 0; length = n; return this; }
160996_85
final public byte getByte() throws IOException { checkAvail( 1 ); return buffer[index++]; }
160996_86
final public short getShort() throws IOException { eckAvail( 2 ); (littleEndian) / little-endian nt value = buffer[index++] & 255; eturn (short) (value + ((buffer[index++] & 255) << 8)); big-endian t value = buffer[index++]; turn (short) ((value << 8) + (buffer[index++] & 255)); }
160996_87
final public int getInt() throws IOException { checkAvail( 4 ); if (littleEndian) { // little-endian int value = buffer[index++] & 255; value += (buffer[index++] & 255) << 8; value += (buffer[index++] & 255) << 16; return value + ((buffer[index++] & 255) << 24); } // big-endian int value = buffer[inde...
160996_88
final public long getLong() throws IOException { eckAvail( 8 ); (littleEndian) / little-endian ong value = buffer[index++] & 255; alue += (long)(buffer[index++] & 255) << 8; alue += (long)(buffer[index++] & 255) << 16; alue += (long)(buffer[index++] & 255) << 24; alue += (long)(buffer[index++] & 255) << 32; alue += (l...
160996_89
final public float getFloat() throws IOException { turn Float.intBitsToFloat( getInt() ); }
160996_90
final public double getDouble() throws IOException { turn Double.longBitsToDouble( getLong() ); }
160996_91
final public void getFully( byte[] b ) throws IOException { checkAvail( b.length ); int n = get( b, 0, b.length ); assert n == b.length; }
160996_92
final public FlexBuffer skip( int len, boolean put ) throws IOException { if (len < 0) throw new IllegalArgumentException( "len < 0" ); if (len == 0) return this; if (put) { ensureLength( index+len ); index += len; fixLength(); return this; } checkAvail( len ); index += len; return this; }
160996_93
final public FlexBuffer skip( int len, boolean put ) throws IOException { if (len < 0) throw new IllegalArgumentException( "len < 0" ); if (len == 0) return this; if (put) { ensureLength( index+len ); index += len; fixLength(); return this; } checkAvail( len ); index += len; return this; }
160996_94
final public FlexBuffer skip( int len, boolean put ) throws IOException { if (len < 0) throw new IllegalArgumentException( "len < 0" ); if (len == 0) return this; if (put) { ensureLength( index+len ); index += len; fixLength(); return this; } checkAvail( len ); index += len; return this; }
160996_95
public void transportMessage( Who recipient, Message msg ) throws Exception { if (msg.getMessageId() != null) throw new IllegalStateException( "message has already been sent" ); msg.setMessageId( idGen.next() ); //Log.report( "MailboxManager.send", "msg", msg ); transport.transportMessage( recipient, msg );...
160996_96
public boolean sessionMessage( Who sender, Message msg ) throws Exception { //Log.report( "MailboxManager.recv", "msg", msg ); Long msgid = msg.getInReplyTo(); if (msgid != null) { Mailbox mb = getMailbox( msgid ); //Log.report( "MailboxManager.recv", "msg", msg, "mb", mb ); if (mb != null) { try { ...
160996_97
public boolean sessionMessage( Who sender, Message msg ) throws Exception { //Log.report( "MailboxManager.recv", "msg", msg ); Long msgid = msg.getInReplyTo(); if (msgid != null) { Mailbox mb = getMailbox( msgid ); //Log.report( "MailboxManager.recv", "msg", msg, "mb", mb ); if (mb != null) { try { ...
160996_98
public boolean sessionMessage( Who sender, Message msg ) throws Exception { //Log.report( "MailboxManager.recv", "msg", msg ); Long msgid = msg.getInReplyTo(); if (msgid != null) { Mailbox mb = getMailbox( msgid ); //Log.report( "MailboxManager.recv", "msg", msg, "mb", mb ); if (mb != null) { try { ...
160996_99
public boolean sessionMessage( Who sender, Message msg ) throws Exception { //Log.report( "MailboxManager.recv", "msg", msg ); Long msgid = msg.getInReplyTo(); if (msgid != null) { Mailbox mb = getMailbox( msgid ); //Log.report( "MailboxManager.recv", "msg", msg, "mb", mb ); if (mb != null) { try { ...
160999_10
public static String formatInetAddr(InetSocketAddress addr) { InetAddress ia = addr.getAddress(); if (ia == null) { return String.format("%s:%s", addr.getHostString(), addr.getPort()); } if (ia instanceof Inet6Address) { return String.format("[%s]:%s", ia.getHostAddress(), addr.getPort()...
160999_11
public static String formatInetAddr(InetSocketAddress addr) { InetAddress ia = addr.getAddress(); if (ia == null) { return String.format("%s:%s", addr.getHostString(), addr.getPort()); } if (ia instanceof Inet6Address) { return String.format("[%s]:%s", ia.getHostAddress(), addr.getPort()...
160999_12
public static String formatInetAddr(InetSocketAddress addr) { InetAddress ia = addr.getAddress(); if (ia == null) { return String.format("%s:%s", addr.getHostString(), addr.getPort()); } if (ia instanceof Inet6Address) { return String.format("[%s]:%s", ia.getHostAddress(), addr.getPort()...
160999_13
public static String[] getIPV6HostAndPort(String hostPort) { if (hostPort.startsWith("[")) { int i = hostPort.lastIndexOf(']'); if (i < 0) { throw new IllegalArgumentException( hostPort + " starts with '[' but has no matching ']'"); } String host = hostPor...
160999_14
public static String[] getIPV6HostAndPort(String hostPort) { if (hostPort.startsWith("[")) { int i = hostPort.lastIndexOf(']'); if (i < 0) { throw new IllegalArgumentException( hostPort + " starts with '[' but has no matching ']'"); } String host = hostPor...
160999_15
public static String[] getIPV6HostAndPort(String hostPort) { if (hostPort.startsWith("[")) { int i = hostPort.lastIndexOf(']'); if (i < 0) { throw new IllegalArgumentException( hostPort + " starts with '[' but has no matching ']'"); } String host = hostPor...
160999_16
public static String[] getIPV6HostAndPort(String hostPort) { if (hostPort.startsWith("[")) { int i = hostPort.lastIndexOf(']'); if (i < 0) { throw new IllegalArgumentException( hostPort + " starts with '[' but has no matching ']'"); } String host = hostPor...
160999_17
public static String[] getIPV6HostAndPort(String hostPort) { if (hostPort.startsWith("[")) { int i = hostPort.lastIndexOf(']'); if (i < 0) { throw new IllegalArgumentException( hostPort + " starts with '[' but has no matching ']'"); } String host = hostPor...
160999_18
public static String[] getIPV6HostAndPort(String hostPort) { if (hostPort.startsWith("[")) { int i = hostPort.lastIndexOf(']'); if (i < 0) { throw new IllegalArgumentException( hostPort + " starts with '[' but has no matching ']'"); } String host = hostPor...
160999_19
public static String[] getIPV6HostAndPort(String hostPort) { if (hostPort.startsWith("[")) { int i = hostPort.lastIndexOf(']'); if (i < 0) { throw new IllegalArgumentException( hostPort + " starts with '[' but has no matching ']'"); } String host = hostPor...
160999_20
@Override public boolean verify(final String host, final SSLSession session) { try { final Certificate[] certs = session.getPeerCertificates(); final X509Certificate x509 = (X509Certificate) certs[0]; verify(host, x509); return true; } catch (final SSLException ex) { log....
160999_21
@Override public void checkServerTrusted( X509Certificate[] chain, String authType, Socket socket) throws CertificateException { x509ExtendedTrustManager.checkServerTrusted(chain, authType, socket); if (serverHostnameVerificationEnabled) { performHostVerification(socket.getInetAddress(), cha...
160999_22
@Override public void checkServerTrusted( X509Certificate[] chain, String authType, Socket socket) throws CertificateException { x509ExtendedTrustManager.checkServerTrusted(chain, authType, socket); if (serverHostnameVerificationEnabled) { performHostVerification(socket.getInetAddress(), cha...
160999_23
@Override public void checkServerTrusted( X509Certificate[] chain, String authType, Socket socket) throws CertificateException { x509ExtendedTrustManager.checkServerTrusted(chain, authType, socket); if (serverHostnameVerificationEnabled) { performHostVerification(socket.getInetAddress(), cha...
160999_24
@Override public void checkServerTrusted( X509Certificate[] chain, String authType, Socket socket) throws CertificateException { x509ExtendedTrustManager.checkServerTrusted(chain, authType, socket); if (serverHostnameVerificationEnabled) { performHostVerification(socket.getInetAddress(), cha...
160999_25
@Override public void checkClientTrusted( X509Certificate[] chain, String authType, Socket socket) throws CertificateException { x509ExtendedTrustManager.checkClientTrusted(chain, authType, socket); if (clientHostnameVerificationEnabled) { performHostVerification(socket.getInetAddress(), cha...
160999_26
@Override public void checkClientTrusted( X509Certificate[] chain, String authType, Socket socket) throws CertificateException { x509ExtendedTrustManager.checkClientTrusted(chain, authType, socket); if (clientHostnameVerificationEnabled) { performHostVerification(socket.getInetAddress(), cha...
160999_27
@Override public void checkClientTrusted( X509Certificate[] chain, String authType, Socket socket) throws CertificateException { x509ExtendedTrustManager.checkClientTrusted(chain, authType, socket); if (clientHostnameVerificationEnabled) { performHostVerification(socket.getInetAddress(), cha...
160999_28
@Override public void checkClientTrusted( X509Certificate[] chain, String authType, Socket socket) throws CertificateException { x509ExtendedTrustManager.checkClientTrusted(chain, authType, socket); if (clientHostnameVerificationEnabled) { performHostVerification(socket.getInetAddress(), cha...
160999_29
public void addPath(final String path) { Objects.requireNonNull(path, "Path cannot be null"); if (path.length() == 0) { throw new IllegalArgumentException("Invalid path: " + path); } final String[] pathComponents = split(path); writeLock.lock(); try { TrieNode parent = rootNode; ...
160999_30
public void addPath(final String path) { Objects.requireNonNull(path, "Path cannot be null"); if (path.length() == 0) { throw new IllegalArgumentException("Invalid path: " + path); } final String[] pathComponents = split(path); writeLock.lock(); try { TrieNode parent = rootNode; ...
160999_31
public void deletePath(final String path) { Objects.requireNonNull(path, "Path cannot be null"); if (path.length() == 0) { throw new IllegalArgumentException("Invalid path: " + path); } final String[] pathComponents = split(path); writeLock.lock(); try { TrieNode parent = rootNod...
160999_32
public void deletePath(final String path) { Objects.requireNonNull(path, "Path cannot be null"); if (path.length() == 0) { throw new IllegalArgumentException("Invalid path: " + path); } final String[] pathComponents = split(path); writeLock.lock(); try { TrieNode parent = rootNod...
160999_33
public String findMaxPrefix(final String path) { Objects.requireNonNull(path, "Path cannot be null"); final String[] pathComponents = split(path); readLock.lock(); try { TrieNode parent = rootNode; TrieNode deepestPropertyNode = null; for (final String element : pathComponents) {...
160999_34
public String findMaxPrefix(final String path) { Objects.requireNonNull(path, "Path cannot be null"); final String[] pathComponents = split(path); readLock.lock(); try { TrieNode parent = rootNode; TrieNode deepestPropertyNode = null; for (final String element : pathComponents) {...
160999_35
public static void validatePath(String path, boolean isSequential) throws IllegalArgumentException { validatePath(isSequential ? path + "1" : path); }
160999_36
public static void validatePath(String path, boolean isSequential) throws IllegalArgumentException { validatePath(isSequential ? path + "1" : path); }
160999_37
public static void validatePath(String path, boolean isSequential) throws IllegalArgumentException { validatePath(isSequential ? path + "1" : path); }
160999_38
public static void validatePath(String path, boolean isSequential) throws IllegalArgumentException { validatePath(isSequential ? path + "1" : path); }
160999_39
public static void validatePath(String path, boolean isSequential) throws IllegalArgumentException { validatePath(isSequential ? path + "1" : path); }
160999_40
public static void validatePath(String path, boolean isSequential) throws IllegalArgumentException { validatePath(isSequential ? path + "1" : path); }
160999_41
public static void validatePath(String path, boolean isSequential) throws IllegalArgumentException { validatePath(isSequential ? path + "1" : path); }
160999_42
public static void validatePath(String path, boolean isSequential) throws IllegalArgumentException { validatePath(isSequential ? path + "1" : path); }
160999_43
public static void validatePath(String path, boolean isSequential) throws IllegalArgumentException { validatePath(isSequential ? path + "1" : path); }
160999_44
public static void validatePath(String path, boolean isSequential) throws IllegalArgumentException { validatePath(isSequential ? path + "1" : path); }
160999_45
public static void validatePath(String path, boolean isSequential) throws IllegalArgumentException { validatePath(isSequential ? path + "1" : path); }
160999_46
public static void validatePath(String path, boolean isSequential) throws IllegalArgumentException { validatePath(isSequential ? path + "1" : path); }
160999_47
public static void validatePath(String path, boolean isSequential) throws IllegalArgumentException { validatePath(isSequential ? path + "1" : path); }
160999_48
public static void validatePath(String path, boolean isSequential) throws IllegalArgumentException { validatePath(isSequential ? path + "1" : path); }
160999_49
public static void validatePath(String path, boolean isSequential) throws IllegalArgumentException { validatePath(isSequential ? path + "1" : path); }
160999_50
public static void validatePath(String path, boolean isSequential) throws IllegalArgumentException { validatePath(isSequential ? path + "1" : path); }
160999_51
public static void validatePath(String path, boolean isSequential) throws IllegalArgumentException { validatePath(isSequential ? path + "1" : path); }
160999_52
public static void validatePath(String path, boolean isSequential) throws IllegalArgumentException { validatePath(isSequential ? path + "1" : path); }
160999_53
public static void validatePath(String path, boolean isSequential) throws IllegalArgumentException { validatePath(isSequential ? path + "1" : path); }
160999_54
public static void validatePath(String path, boolean isSequential) throws IllegalArgumentException { validatePath(isSequential ? path + "1" : path); }
160999_55
static FileKeyStoreLoader.Builder<? extends FileKeyStoreLoader> getBuilderForKeyStoreFileType(KeyStoreFileType type) { switch (Objects.requireNonNull(type)) { case JKS: return new JKSFileLoader.Builder(); case PEM: return new PEMFileLoader.Builder(); case PKCS12: return new PKCS1...
160999_56
static FileKeyStoreLoader.Builder<? extends FileKeyStoreLoader> getBuilderForKeyStoreFileType(KeyStoreFileType type) { switch (Objects.requireNonNull(type)) { case JKS: return new JKSFileLoader.Builder(); case PEM: return new PEMFileLoader.Builder(); case PKCS12: return new PKCS1...
160999_57
static FileKeyStoreLoader.Builder<? extends FileKeyStoreLoader> getBuilderForKeyStoreFileType(KeyStoreFileType type) { switch (Objects.requireNonNull(type)) { case JKS: return new JKSFileLoader.Builder(); case PEM: return new PEMFileLoader.Builder(); case PKCS12: return new PKCS1...
160999_58
static FileKeyStoreLoader.Builder<? extends FileKeyStoreLoader> getBuilderForKeyStoreFileType(KeyStoreFileType type) { switch (Objects.requireNonNull(type)) { case JKS: return new JKSFileLoader.Builder(); case PEM: return new PEMFileLoader.Builder(); case PKCS12: return new PKCS1...
160999_59
public boolean getBoolean(String key) { return getBoolean(key, false); }
160999_60
@Override public int hashCode() { int hash = results.size(); for (OpResult result : results) { hash = (hash * 35) + result.hashCode(); } return hash; }
160999_61
public void delete(final String path, int version) throws InterruptedException, KeeperException { final String clientPath = path; PathUtils.validatePath(clientPath); final String serverPath; // maintain semantics even in chroot case // specifically - root cannot be deleted // I think this makes ...
160999_62
public Stat setData(final String path, byte[] data, int version) throws KeeperException, InterruptedException { final String clientPath = path; PathUtils.validatePath(clientPath); final String serverPath = prependChroot(clientPath); RequestHeader h = new RequestHeader(); h.setType(ZooDefs.OpCode.set...
160999_63
@Override public String toString() { States state = getState(); return ("State:" + state.toString() + (state.isConnected() ? " Timeout:" + getSessionTimeout() + " " : " ") + cnxn); }
160999_64
public String create( final String path, byte[] data, List<ACL> acl, CreateMode createMode) throws KeeperException, InterruptedException { final String clientPath = path; PathUtils.validatePath(clientPath, createMode.isSequential()); EphemeralType.validateTTL(createMode, -1); validateACL...
160999_65
@Override public int hashCode() { int h = 1023; for (Op op : ops) { h = h * 25 + op.hashCode(); } return h; }
160999_66
public synchronized Long convertAcls(List<ACL> acls) { if (acls == null) { return OPEN_UNSAFE_ACL_ID; } // get the value from the map Long ret = aclKeyMap.get(acls); if (ret == null) { ret = incrementIndex(); longKeyMap.put(ret, acls); aclKeyMap.put(acls, ret); } ...
160999_67
public synchronized Long convertAcls(List<ACL> acls) { if (acls == null) { return OPEN_UNSAFE_ACL_ID; } // get the value from the map Long ret = aclKeyMap.get(acls); if (ret == null) { ret = incrementIndex(); longKeyMap.put(ret, acls); aclKeyMap.put(acls, ret); } ...
160999_68
public synchronized void addUsage(Long acl) { if (acl == OPEN_UNSAFE_ACL_ID) { return; } if (!longKeyMap.containsKey(acl)) { LOG.info("Ignoring acl {} as it does not exist in the cache", acl); return; } AtomicLong count = referenceCounter.get(acl); if (count == null) { ...
160999_69
public synchronized void purgeUnused() { Iterator<Map.Entry<Long, AtomicLongWithEquals>> refCountIter = referenceCounter.entrySet().iterator(); while (refCountIter.hasNext()) { Map.Entry<Long, AtomicLongWithEquals> entry = refCountIter.next(); if (entry.getValue().get() <= 0) { Long ...
160999_70
@Override public void start() { stopped = false; if (workerPool == null) { workerPool = new WorkerService("NIOWorker", numWorkerThreads, false); } for (SelectorThread thread : selectorThreads) { if (thread.getState() == Thread.State.NEW) { thread.start(); } } ...
160999_71
public void shutdown() { try { // close listen socket and signal selector threads to stop stop(); // wait for selector and worker threads to shutdown join(); // close all open connections closeAll(ServerCnxn.DisconnectReason.SERVER_SHUTDOWN); if (login != null...
160999_72
@Override public void sendCloseSession() { sendBuffer(ServerCnxnFactory.closeConn); }
160999_73
@Override protected ServerStats serverStats() { if (zkServer == null) { return null; } return zkServer.serverStats(); }
160999_74
static String trimPathDepth(String path, int maxDepth) { int count = 0; StringBuilder sb = new StringBuilder(); StringTokenizer pathTokenizer = new StringTokenizer(path, PATH_SEPERATOR); while (pathTokenizer.hasMoreElements() && count++ < maxDepth) { sb.append(PATH_SEPERATOR); sb.append(...