@Override public boolean equals(Object obj) { if ((obj == null) || !(obj instanceof EstimateMapKey)) { return false; } EstimateMapKey that = (EstimateMapKey)obj; return this.clientId.equals(that.clientId) && this.serverId.equals(that.serverId); } }
@Override public boolean equals(Object obj) { if ((obj == null) || !(obj instanceof EstimateMapKey)) { return false; } EstimateMapKey that = (EstimateMapKey)obj; return this.clientId.equals(that.clientId) && this.serverId.equals(that.serverId); } }
/** * If it is most loaded then return its LoadHolder; otherwise return null; */ private LoadHolder isCurrentServerMostLoaded(ServerLocation currentServer, Map groupServers) { final LoadHolder currentLH = (LoadHolder)groupServers.get(currentServer); if (currentLH == null) return null; final float currentLoad = currentLH.getLoad(); for (Iterator itr = groupServers.entrySet().iterator(); itr.hasNext();) { Map.Entry next = (Entry)itr.next(); ServerLocation location = (ServerLocation)next.getKey(); if (location.equals(currentServer)) { continue; } LoadHolder nextLoadReference = (LoadHolder)next.getValue(); float nextLoad = nextLoadReference.getLoad(); if (nextLoad > currentLoad) { // found a guy who has a higher load than us so... return null; } } return currentLH; }
/** * If it is most loaded then return its LoadHolder; otherwise return null; */ private LoadHolder isCurrentServerMostLoaded(ServerLocation currentServer, Map groupServers) { final LoadHolder currentLH = (LoadHolder)groupServers.get(currentServer); if (currentLH == null) return null; final float currentLoad = currentLH.getLoad(); for (Iterator itr = groupServers.entrySet().iterator(); itr.hasNext();) { Map.Entry next = (Entry)itr.next(); ServerLocation location = (ServerLocation)next.getKey(); if (location.equals(currentServer)) { continue; } LoadHolder nextLoadReference = (LoadHolder)next.getValue(); float nextLoad = nextLoadReference.getLoad(); if (nextLoad > currentLoad) { // found a guy who has a higher load than us so... return null; } } return currentLH; }
/** * Returns a pooled connection that can have its underlying cnx * to currentServer replaced by a new connection. * @return null if a target could not be found */ public synchronized PooledConnection findReplacementTarget(ServerLocation currentServer) { final long now = System.nanoTime(); for (Iterator it = this.allConnections.iterator(); it.hasNext();) { PooledConnection pc = (PooledConnection)it.next(); if (currentServer.equals(pc.getServer())) { if (!pc.shouldDestroy() && pc.remainingLife(now, lifetimeTimeoutNanos) <= 0) { removeFromEndpointMap(pc); return pc; } } } return null; }
this.connectionManager.activate(conn); borrow = false; if (!conn.getServer().equals(server)) {
else if ( currentServer.equals(pc.getServer()) ) {
else if ( currentServer.equals(pc.getServer()) ) {
/** * Returns a pooled connection that can have its underlying cnx * to currentServer replaced by a new connection. * @return null if a target could not be found */ public synchronized PooledConnection findReplacementTarget(ServerLocation currentServer) { final long now = System.nanoTime(); for (Iterator it = this.allConnections.iterator(); it.hasNext();) { PooledConnection pc = (PooledConnection)it.next(); if (currentServer.equals(pc.getServer())) { if (!pc.shouldDestroy() && pc.remainingLife(now, lifetimeTimeoutNanos) <= 0) { removeFromEndpointMap(pc); return pc; } } } return null; }
this.connectionManager.activate(conn); borrow = false; if (!conn.getServer().equals(server)) {
/** * Make sure two ServerLocation objects on different hosts but with the same port * are not equal */ public void testBug42040() { ServerLocation sl1 = new ServerLocation("host1", 777); ServerLocation sl2 = new ServerLocation("host2", 777); if (sl1.equals(sl2)) { fail("ServerLocation instances on different hosts should not test equal"); } }
else if ( sl.equals(pc.getEndpoint().getLocation()) ) {
else if ( sl.equals(pc.getEndpoint().getLocation()) ) {
else if ( sl.equals(pc.getEndpoint().getLocation()) ) {
else if ( sl.equals(pc.getEndpoint().getLocation()) ) {
public static void verifyUpdaterThreadIsAlive() throws InterruptedException { QueueConnectionImpl conn2 = (QueueConnectionImpl) pool.getPrimaryConnection(); Assert.assertNotSame(conn1, conn2); Assert.assertFalse(conn1.getServer().equals(conn2.getServer())); assertNull(((QueueConnectionImpl)conn1).getUpdater()); assertTrue((conn2).getUpdater().isAlive()); }
if (sl.equals(currentServer)) { this.allConnectionsMap.extendLifeOfCnxToServer(currentServer); break;
|| !this.connection.getServer().equals(this.sender.getServerLocation())) { if (this.logger.fineEnabled()) { logger