개체 풀에 개체를 추가하려고합니다. 나는 이것을 위해 아파치 공유 풀을 사용하고있다. 다음과 같이개체 풀에 개체 추가
내 코드 :
public ObjectPool<OAuthConsumer> consumerPool;
public ObjectPool<OAuthConsumer> consumerPool;
public void buildConsumerPool(){
//setting the config path
PropertyHandler.setConfigPath("/twitter.properties");
//fetching required tokens for all apps
String consumerKeySet = PropertyHandler.getProperty("consumerKey");
String consumerSecretSet = PropertyHandler.getProperty("consumerSecret");
String accessTokenSet = PropertyHandler.getProperty("accessToken");
String tokenSecretSet = PropertyHandler.getProperty("tokenSecret");
String[] splitconsumerKeys = consumerKeySet.split(",");
String[] splitconsumerSecret = consumerSecretSet.split(".");
String[] splitaccessToken = accessTokenSet.split(",");
String[] splittokenSecret = tokenSecretSet.split(".");
//creating consumer objects for each app
for (int numberOfAccounts = 0; numberOfAccounts < splitconsumerKeys.length; numberOfAccounts++) {
String consumerKey = splitconsumerKeys[numberOfAccounts];
String consumerSecret = splitconsumerSecret[numberOfAccounts];
String accessToken = splitaccessToken[numberOfAccounts];
String tokenSecret = splittokenSecret[numberOfAccounts];
OAuthConsumer consumer = new CommonsHttpOAuthConsumer(consumerKey, consumerSecret);
consumer.setTokenWithSecret(accessToken, tokenSecret);
}
지금 내가 전에 만든 풀에 소비자 개체를 추가하려고합니다. 어떻게해야합니까? 도움이 될
consumerPool.addObject (소비) 트릭을하지 않습니까? – Raam
addObject가 매개 변수를 사용하지 않습니다. 나는 확인했다. –