public final int getConnectionSizeBySocketAddress(InetSocketAddress address) { Queue<Session> sessionList = this.connector.getSessionByAddress(address); return sessionList == null ? 0 : sessionList.size(); }
private void flushSpecialMemcachedServer(InetSocketAddress address, long timeout, boolean noreply, int exptime) throws MemcachedException, InterruptedException, TimeoutException { if (address == null) { throw new IllegalArgumentException("Null adderss"); } CountDownLatch latch = new CountDownLatch(1); Queue<Session> sessionQueue = this.connector.getSessionByAddress(address); if (sessionQueue == null || sessionQueue.peek() == null) { throw new MemcachedException( "could not find session for " + SystemUtils.getRawAddress(address) + ":" + address.getPort() + ",maybe it have not been connected"); } Command command = this.commandFactory.createFlushAllCommand(latch, exptime, noreply); final Session session = sessionQueue.peek(); session.write(command); if (!noreply) { this.latchWait(command, timeout, session); } }
private void setMemcachedLoggingLevel(InetSocketAddress address, int level, boolean noreply) throws MemcachedException, InterruptedException, TimeoutException { if (address == null) { throw new IllegalArgumentException("Null adderss"); } CountDownLatch latch = new CountDownLatch(1); Queue<Session> sessionQueue = this.connector.getSessionByAddress(address); if (sessionQueue == null || sessionQueue.peek() == null) { throw new MemcachedException( "could not find session for " + SystemUtils.getRawAddress(address) + ":" + address.getPort() + ",maybe it have not been connected"); } Command command = this.commandFactory.createVerbosityCommand(latch, level, noreply); final Session session = sessionQueue.peek(); session.write(command); if (!noreply) { this.latchWait(command, this.opTimeout, session); } }
@SuppressWarnings("unchecked") public final Map<String, String> stats(InetSocketAddress address, long timeout) throws MemcachedException, InterruptedException, TimeoutException { if (address == null) { throw new IllegalArgumentException("Null inetSocketAddress"); } CountDownLatch latch = new CountDownLatch(1); Queue<Session> sessionQueue = this.connector.getSessionByAddress(address); if (sessionQueue == null || sessionQueue.peek() == null) { throw new MemcachedException( "could not find session for " + SystemUtils.getRawAddress(address) + ":" + address.getPort() + ",maybe it have not been connected"); } Command command = this.commandFactory.createStatsCommand(address, latch, null); final Session session = sessionQueue.peek(); session.write(command); this.latchWait(command, timeout, session); return (Map<String, String>) command.getResult(); }
public final void setServerWeight(String server, int weight) { InetSocketAddress socketAddress = AddrUtil.getOneAddress(server); Queue<Session> sessionQueue = this.connector.getSessionByAddress(socketAddress); if (sessionQueue == null) { throw new IllegalArgumentException("There is no server " + server); } for (Session session : sessionQueue) { if (session != null) { ((MemcachedTCPSession) session).getInetSocketAddressWrapper().setWeight(weight); } } this.connector.updateSessions(); }
throw new IllegalArgumentException("null address"); Queue<Session> sessions = this.connector.getSessionByAddress(address); if (sessions == null || sessions.size() == 0) { throw new MemcachedException(
protected void removeAddr(InetSocketAddress address) { // Close main sessions Queue<Session> sessionQueue = this.connector.getSessionByAddress(address); if (sessionQueue != null) { for (Session session : sessionQueue) { if (session != null) { // Disable auto reconnection ((MemcachedSession) session).setAllowReconnect(false); // Close connection ((MemcachedSession) session).quit(); } } } // Close standby sessions List<Session> standBySession = this.connector.getStandbySessionListByMainNodeAddr(address); if (standBySession != null) { for (Session session : standBySession) { if (session != null) { this.connector.removeReconnectRequest(session.getRemoteSocketAddress()); // Disable auto reconnection ((MemcachedSession) session).setAllowReconnect(false); // Close connection ((MemcachedSession) session).quit(); } } } this.connector.removeReconnectRequest(address); }
public final int getConnectionSizeBySocketAddress(InetSocketAddress address) { Queue<Session> sessionList = this.connector.getSessionByAddress(address); return sessionList == null ? 0 : sessionList.size(); }
private void setMemcachedLoggingLevel(InetSocketAddress address, int level, boolean noreply) throws MemcachedException, InterruptedException, TimeoutException { if (address == null) { throw new IllegalArgumentException("Null adderss"); } CountDownLatch latch = new CountDownLatch(1); Queue<Session> sessionQueue = this.connector.getSessionByAddress(address); if (sessionQueue == null || sessionQueue.peek() == null) { throw new MemcachedException( "could not find session for " + SystemUtils.getRawAddress(address) + ":" + address.getPort() + ",maybe it have not been connected"); } Command command = this.commandFactory.createVerbosityCommand(latch, level, noreply); final Session session = sessionQueue.peek(); session.write(command); if (!noreply) { this.latchWait(command, this.opTimeout, session); } }
private void flushSpecialMemcachedServer(InetSocketAddress address, long timeout, boolean noreply, int exptime) throws MemcachedException, InterruptedException, TimeoutException { if (address == null) { throw new IllegalArgumentException("Null adderss"); } CountDownLatch latch = new CountDownLatch(1); Queue<Session> sessionQueue = this.connector.getSessionByAddress(address); if (sessionQueue == null || sessionQueue.peek() == null) { throw new MemcachedException( "could not find session for " + SystemUtils.getRawAddress(address) + ":" + address.getPort() + ",maybe it have not been connected"); } Command command = this.commandFactory.createFlushAllCommand(latch, exptime, noreply); final Session session = sessionQueue.peek(); session.write(command); if (!noreply) { this.latchWait(command, timeout, session); } }
public final void setServerWeight(String server, int weight) { InetSocketAddress socketAddress = AddrUtil.getOneAddress(server); Queue<Session> sessionQueue = this.connector.getSessionByAddress(socketAddress); if (sessionQueue == null) { throw new IllegalArgumentException("There is no server " + server); } for (Session session : sessionQueue) { if (session != null) { ((MemcachedTCPSession) session).getInetSocketAddressWrapper().setWeight(weight); } } this.connector.updateSessions(); }
@SuppressWarnings("unchecked") public final Map<String, String> stats(InetSocketAddress address, long timeout) throws MemcachedException, InterruptedException, TimeoutException { if (address == null) { throw new IllegalArgumentException("Null inetSocketAddress"); } CountDownLatch latch = new CountDownLatch(1); Queue<Session> sessionQueue = this.connector.getSessionByAddress(address); if (sessionQueue == null || sessionQueue.peek() == null) { throw new MemcachedException( "could not find session for " + SystemUtils.getRawAddress(address) + ":" + address.getPort() + ",maybe it have not been connected"); } Command command = this.commandFactory.createStatsCommand(address, latch, null); final Session session = sessionQueue.peek(); session.write(command); this.latchWait(command, timeout, session); return (Map<String, String>) command.getResult(); }
throw new IllegalArgumentException("null address"); Queue<Session> sessions = this.connector.getSessionByAddress(address); if (sessions == null || sessions.size() == 0) { throw new MemcachedException(
protected void removeAddr(InetSocketAddress address) { // Close main sessions Queue<Session> sessionQueue = this.connector.getSessionByAddress(address); if (sessionQueue != null) { for (Session session : sessionQueue) { if (session != null) { // Disable auto reconnection ((MemcachedSession) session).setAllowReconnect(false); // Close connection ((MemcachedSession) session).quit(); } } } // Close standby sessions List<Session> standBySession = this.connector.getStandbySessionListByMainNodeAddr(address); if (standBySession != null) { for (Session session : standBySession) { if (session != null) { this.connector.removeReconnectRequest(session.getRemoteSocketAddress()); // Disable auto reconnection ((MemcachedSession) session).setAllowReconnect(false); // Close connection ((MemcachedSession) session).quit(); } } } this.connector.removeReconnectRequest(address); }