当前位置: 首页>>代码示例>>Java>>正文


Java PooledObject.getObject方法代码示例

本文整理汇总了Java中org.apache.commons.pool2.PooledObject.getObject方法的典型用法代码示例。如果您正苦于以下问题:Java PooledObject.getObject方法的具体用法?Java PooledObject.getObject怎么用?Java PooledObject.getObject使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.commons.pool2.PooledObject的用法示例。


在下文中一共展示了PooledObject.getObject方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: validateObject

import org.apache.commons.pool2.PooledObject; //导入方法依赖的package包/类
@Override
public boolean validateObject(PooledObject<Jedis> pooledJedis) {
  final BinaryJedis jedis = pooledJedis.getObject();
  try {
    HostAndPort hostAndPort = this.hostAndPort.get();

    String connectionHost = jedis.getClient().getHost();
    int connectionPort = jedis.getClient().getPort();

    return hostAndPort.getHost().equals(connectionHost)
        && hostAndPort.getPort() == connectionPort && jedis.isConnected()
        && jedis.ping().equals("PONG");
  } catch (final Exception e) {
    return false;
  }
}
 
开发者ID:x7-framework,项目名称:x7,代码行数:17,代码来源:JedisFactory.java

示例2: passivateObject

import org.apache.commons.pool2.PooledObject; //导入方法依赖的package包/类
@Override
public void passivateObject(Event.Type key, PooledObject<Event> pooledObject) throws Exception {
    final Event event = pooledObject.getObject();
    switch (event.type) {
        case BEFORE:
            unsafe.putObject(event, targetFieldInBeforeEventOffset, null);
            unsafe.putObject(event, argumentArrayFieldInBeforeEventOffset, null);
            break;
        case IMMEDIATELY_THROWS:
        case THROWS:
            unsafe.putObject(event, throwableFieldInThrowsEventOffset, null);
            break;
        case IMMEDIATELY_RETURN:
        case RETURN:
            unsafe.putObject(event, objectFieldInReturnEventOffset, null);
    }
}
 
开发者ID:alibaba,项目名称:jvm-sandbox,代码行数:18,代码来源:EventPool.java

示例3: validateObject

import org.apache.commons.pool2.PooledObject; //导入方法依赖的package包/类
@Override
public boolean validateObject(PooledObject<Jedis> pooledJedis) {
    final BinaryJedis jedis = pooledJedis.getObject();
    try {
        HostAndPort hostAndPort = this.hostAndPort.get();
        String connectionHost = jedis.getClient().getHost();
        int connectionPort = jedis.getClient().getPort();

        return hostAndPort.getHost().equals(connectionHost)
                && hostAndPort.getPort() == connectionPort && jedis.isConnected()
                && jedis.ping().equals("PONG");
    } catch (final Exception e) {
        return false;
    }
}
 
开发者ID:YanXs,项目名称:nighthawk,代码行数:16,代码来源:JaRedisFactory.java

示例4: activateObject

import org.apache.commons.pool2.PooledObject; //导入方法依赖的package包/类
@Override
public void activateObject(PooledObject<Jedis> pooledJedis) throws Exception {
    final BinaryJedis jedis = pooledJedis.getObject();
    if (jedis.getDB() != database) {
        jedis.select(database);
    }
}
 
开发者ID:YanXs,项目名称:nighthawk,代码行数:8,代码来源:JaRedisFactory.java

示例5: activateObject

import org.apache.commons.pool2.PooledObject; //导入方法依赖的package包/类
@Override
public void activateObject(PooledObject<Jedis> pooledJedis) throws Exception {
	final BinaryJedis jedis = pooledJedis.getObject();
	if (jedis.getDB() != database) {
		jedis.select(database);
	}

}
 
开发者ID:qq1588518,项目名称:JRediClients,代码行数:9,代码来源:JedisFactory.java

示例6: validateObject

import org.apache.commons.pool2.PooledObject; //导入方法依赖的package包/类
@Override
public boolean validateObject(PooledObject<Jedis> pooledJedis) {
	final BinaryJedis jedis = pooledJedis.getObject();
	try {
		HostAndPort hostAndPort = this.hostAndPort.get();

		String connectionHost = jedis.getClient().getHost();
		int connectionPort = jedis.getClient().getPort();

		return hostAndPort.getHost().equals(connectionHost) && hostAndPort.getPort() == connectionPort
				&& jedis.isConnected() && jedis.ping().equals("PONG");
	} catch (final Exception e) {
		return false;
	}
}
 
开发者ID:qq1588518,项目名称:JRediClients,代码行数:16,代码来源:JedisFactory.java

示例7: validateObject

import org.apache.commons.pool2.PooledObject; //导入方法依赖的package包/类
@Override
public boolean validateObject(PooledObject<ShardedJedis> pooledShardedJedis) {
	try {
		ShardedJedis jedis = pooledShardedJedis.getObject();
		for (Jedis shard : jedis.getAllShards()) {
			if (!shard.ping().equals("PONG")) {
				return false;
			}
		}
		return true;
	} catch (Exception ex) {
		return false;
	}
}
 
开发者ID:qq1588518,项目名称:JRediClients,代码行数:15,代码来源:ShardedJedisPool.java

示例8: destroyObject

import org.apache.commons.pool2.PooledObject; //导入方法依赖的package包/类
@Override
public void destroyObject(ConnectionDetails connectionDetails, PooledObject<Session> sessionObject) {
    log.debug("Destroying session for "+connectionDetails);
    if (sessionObject != null) {
        Session session = sessionObject.getObject();
        if (session != null) {
            session.disconnect();
        }
    }
}
 
开发者ID:tilln,项目名称:jmeter-sshmon,代码行数:11,代码来源:SSHSessionFactory.java

示例9: activateObject

import org.apache.commons.pool2.PooledObject; //导入方法依赖的package包/类
@Override
public void activateObject(final PooledObject<Session> p) throws BackgroundException {
    final Session session = p.getObject();
    if(log.isDebugEnabled()) {
        log.debug(String.format("Activate session %s", session));
    }
    // Load vault to increment open count for pooled vault
    connect.check(session, cache, new DisabledCancelCallback());
}
 
开发者ID:iterate-ch,项目名称:cyberduck,代码行数:10,代码来源:PooledSessionFactory.java

示例10: passivateObject

import org.apache.commons.pool2.PooledObject; //导入方法依赖的package包/类
@Override
public void passivateObject(final PooledObject<Session> p) throws Exception {
    final Session session = p.getObject();
    if(log.isDebugEnabled()) {
        log.debug(String.format("Pause session %s", session));
    }
}
 
开发者ID:iterate-ch,项目名称:cyberduck,代码行数:8,代码来源:PooledSessionFactory.java

示例11: destroyObject

import org.apache.commons.pool2.PooledObject; //导入方法依赖的package包/类
@Override
public void destroyObject(final PooledObject<Session> p) throws BackgroundException {
    final Session session = p.getObject();
    if(log.isDebugEnabled()) {
        log.debug(String.format("Destroy session %s", session));
    }
    session.close();
}
 
开发者ID:iterate-ch,项目名称:cyberduck,代码行数:9,代码来源:PooledSessionFactory.java

示例12: passivateObject

import org.apache.commons.pool2.PooledObject; //导入方法依赖的package包/类
@Override
public void passivateObject(PooledObject<PooledFastResource> p) throws Exception {
    PooledFastResource resource = p.getObject();
    synchronized (resource) {
        resource.getStorageServer().close();
        resource.getTrackerServer().close();
    }
}
 
开发者ID:devpage,项目名称:fastdfs-quickstart,代码行数:9,代码来源:FastPool.java

示例13: activateObject

import org.apache.commons.pool2.PooledObject; //导入方法依赖的package包/类
@Override
public void activateObject(PooledObject<Jedis> pooledJedis) throws Exception {
  final BinaryJedis jedis = pooledJedis.getObject();
  if (jedis.getDB() != database) {
    jedis.select(database);
  }

}
 
开发者ID:x7-framework,项目名称:x7,代码行数:9,代码来源:JedisFactory.java

示例14: validateObject

import org.apache.commons.pool2.PooledObject; //导入方法依赖的package包/类
@Override
public boolean validateObject(PooledObject<ShardedJedis> pooledShardedJedis) {
  try {
    ShardedJedis jedis = pooledShardedJedis.getObject();
    for (Jedis shard : jedis.getAllShards()) {
      if (!shard.ping().equals("PONG")) {
        return false;
      }
    }
    return true;
  } catch (Exception ex) {
    return false;
  }
}
 
开发者ID:x7-framework,项目名称:x7,代码行数:15,代码来源:ShardedJedisPool.java

示例15: destroyObject

import org.apache.commons.pool2.PooledObject; //导入方法依赖的package包/类
@Override
public void destroyObject(PooledObject<KuduClient> pooledKuduClient)
        throws Exception
{
    final KuduClient kuduClient = pooledKuduClient.getObject();
    kuduClient.close();
}
 
开发者ID:trackingio,项目名称:presto-kudu,代码行数:8,代码来源:KuduClientFactory.java


注:本文中的org.apache.commons.pool2.PooledObject.getObject方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。