| @@ -47,15 +47,11 @@ public class PostBack | |||
| private static final int QUEUE_WAIT = 300; // seconds | |||
| private static final int POSTBACK_SERVER_WAIT_TIME = 10; // seconds | |||
| private static final int THREADPOOL_SIZE_DEFAULT = 2; | |||
| private static final int MAX_QUEUE_SIZE_DEFAULT = 10000; | |||
| private static final int MAX_BATCH_SIZE_DEFAULT = 100; | |||
| private final String postBackURL; | |||
| private final String xmlTopElement; | |||
| private Queue<String> postQueue; | |||
| private final int maxQueueSize; | |||
| private final int senderPoolSize; | |||
| private List<Sender> senderPool; | |||
| private final String myName; | |||
| private int maxBatchSize; | |||
| @@ -295,7 +291,9 @@ public class PostBack | |||
| * @throws IllegalArgumentException if either postBackURL or xmlTopElementName is | |||
| * not supplied nor valid. | |||
| */ | |||
| public PostBack(String postBackURL, String xmlTopElementName) throws IllegalArgumentException | |||
| public PostBack(String postBackURL, String xmlTopElementName, | |||
| int maxQueueSize, int senderPoolSize, int maxBatchSize) | |||
| throws IllegalArgumentException | |||
| { | |||
| if (postBackURL == null || postBackURL.length() == 0) | |||
| { | |||
| @@ -308,35 +306,10 @@ public class PostBack | |||
| } | |||
| this.postBackURL = postBackURL; | |||
| this.xmlTopElement = xmlTopElementName; | |||
| this.maxQueueSize = maxQueueSize; | |||
| this.maxBatchSize = maxBatchSize; | |||
| postQueue = new LinkedList<String>(); | |||
| int max_queue_size = 0; | |||
| String maxQueueSizeStr = System.getProperty("postback_max_queue_size"); | |||
| if (maxQueueSizeStr != null && (maxQueueSizeStr=maxQueueSizeStr.trim()).length() > 0) | |||
| { | |||
| max_queue_size = Integer.parseInt(maxQueueSizeStr); | |||
| } | |||
| maxQueueSize = max_queue_size > 0? max_queue_size : MAX_QUEUE_SIZE_DEFAULT; | |||
| CommonLogger.activity.info("Postback max queue size = " + maxQueueSize); | |||
| int poolSize = 0; | |||
| String senderSizeStr = System.getProperty("postback_threadpool_size"); | |||
| if (senderSizeStr != null && (senderSizeStr=senderSizeStr.trim()).length() > 0) | |||
| { | |||
| poolSize = Integer.parseInt(senderSizeStr); | |||
| } | |||
| senderPoolSize = poolSize > 0? poolSize : THREADPOOL_SIZE_DEFAULT; | |||
| CommonLogger.activity.info("Postback threadpool size = " + senderPoolSize); | |||
| int configuredMax = 0; | |||
| String maxBatchSizeStr = System.getProperty("postback_max_batch_size"); | |||
| if (maxBatchSizeStr != null && (maxBatchSizeStr=maxBatchSizeStr.trim()).length() > 0) | |||
| { | |||
| configuredMax = Integer.parseInt(maxBatchSizeStr); | |||
| } | |||
| maxBatchSize = configuredMax > 0? configuredMax: MAX_BATCH_SIZE_DEFAULT; | |||
| CommonLogger.activity.info("Postback max batch size = " + maxBatchSize); | |||
| senderPool = new ArrayList<Sender>(); | |||
| for (int i = 0; i < senderPoolSize; i++) | |||
| { | |||