rem
stringlengths
0
477k
add
stringlengths
0
313k
context
stringlengths
6
599k
_cache = new Hashtable();
_cache = new ScalableMap(1001);
public void init(Broker b, Properties config) throws InitException { _log = b.getLog("resource"); _cache = new Hashtable(); }
} if (!serviceFactory.isEnabled()) { throw new ServiceRegistrationException(serviceName, new IllegalServiceStateException("A disabled non-restartable service factory can not be registered", serviceName));
public void registerService(ServiceName serviceName, ServiceFactory serviceFactory, ClassLoader classLoader) throws ServiceAlreadyExistsException, ServiceRegistrationException { assert serviceName != null : "serviceName is null"; assert serviceFactory != null : "serviceFactory is null"; assert ...
context.put ("OWNM", new ObjectWithNullMethod());
public void stuffContext (Context context) throws Exception { context.setEvaluationExceptionHandler ( new DefaultEvaluationExceptionHandler ()); context.put ("TestObject", new TestObject()); context.put ("NullTestObject", new NullTestObject()); context.put ("NullObject", null); }
if (br != null) { try { br.close(); } catch (IOException e2) { } }
private String generateHtmlizedJavaSource(SourceFileData sourceFileData) { File sourceFile = null; try { sourceFile = finder.getFileForSource(sourceFileData.getName()); } catch (IOException e) { return "<p>Unable to locate " + sourceFileData.getName() + ". Have you specified the source directory?</p>"; ...
if ((jjbitVec0[i2] & l2) != 0L && kind > 32)
if (jjCanMove_0(hiByte, i1, i2, l1, l2) && kind > 32)
private final int jjMoveNfa_0(int startState, int curPos){ int[] nextStates; int startsAt = 0; jjnewStateCnt = 48; int i = 1; jjstateSet[0] = startState; int j, kind = 0x7fffffff; for (;;) { if (++jjround == 0x7fffffff) ReInitRounds(); if (curChar < 64) { long l = 1L << cu...
if ((jjbitVec0[i2] & l2) != 0L)
if (jjCanMove_0(hiByte, i1, i2, l1, l2))
private final int jjMoveNfa_0(int startState, int curPos){ int[] nextStates; int startsAt = 0; jjnewStateCnt = 48; int i = 1; jjstateSet[0] = startState; int j, kind = 0x7fffffff; for (;;) { if (++jjround == 0x7fffffff) ReInitRounds(); if (curChar < 64) { long l = 1L << cu...
this.iterationCount = _wm.getBroker().getIntegerSetting("TestSyntheticTemplate.IterationCount", this.threadCount);
this.iterationCount = _wm.getBroker().getIntegerSetting("TestSyntheticTemplate.IterationCount", this.IterationCount);
public static Test suite() { TestSuite suite= new TestSuite(); suite.addTest(new TestSyntheticTemplate("load") { protected WebMacro createWebMacro() throws Exception { return new WM("org/webmacro/template/TST.properties"); } protected void runTest() throws Exception { ...
this.iterationCount = _wm.getBroker().getIntegerSetting("TestSyntheticTemplate.IterationCount", this.threadCount);
this.iterationCount = _wm.getBroker().getIntegerSetting("TestSyntheticTemplate.IterationCount", this.IterationCount);
protected void runTest() throws Exception { this.threadCount = _wm.getBroker().getIntegerSetting("TestSyntheticTemplate.ThreadCount", this.threadCount); this.iterationCount = _wm.getBroker().getIntegerSetting("TestSyntheticTemplate.IterationCount", this.threadCount); this.testLoadAndT...
SelectList sl = new SelectList(fruits, 3); context.put("sl-fruits", sl);
public static void main(String arg[]) { Log.traceExceptions(true); Log.setLevel(Log.ALL); Log.setTarget(System.err); if (arg.length != 0) { System.out.println("Enabling log types"); Log.enableTypes(arg); } // Build a context WebMacro wm = null; Hashtable con...
else {
else if (!selected && boldWhenActive) { textLabel.setFont(defaultFont); } else if(selected){ textLabel.setFont(defaultFont);
public void setSelected(boolean selected) { super.setSelected(selected); this.selected = selected; if (boldWhenActive && selected) { textLabel.setFont(textLabel.getFont().deriveFont(Font.BOLD)); } else { // textLabel.setFont(defaultFont); } inval...
return new XBeanNamespaceHandlerResolver(getBeanClassLoader());
ClassLoader classLoader = getBeanClassLoader(); if (classLoader == null) { classLoader = Thread.currentThread().getContextClassLoader(); } return new XBeanNamespaceHandlerResolver(classLoader);
protected NamespaceHandlerResolver createDefaultNamespaceHandlerResolver() { return new XBeanNamespaceHandlerResolver(getBeanClassLoader()); }
URL url = _broker.getResource(resource);
URL url = null; ClassLoader cl = this.getClass().getClassLoader(); if (cl != null) { url = cl.getResource(resource); } else { url = ClassLoader.getSystemResource(resource); }
private final URL searchClasspath(String resource) { _log.debug("Searching classpath for "+resource); URL url = _broker.getResource(resource); if (url != null) { return url; } /* * look for locale specific resources AAAA{_xxxx_yyyyy_....}BBBBB ...
if (!isEmpty(uri) || !reservedElementNames.contains(localName)) {
if (uri == null || uri.equals(SPRING_SCHEMA)) { if (BEAN_ELEMENT.equals(localName)) { return parseBeanDefinitionElement(childElement, true); } } else {
protected Object parseChildExtensionBean(Element element) { NodeList nl = element.getChildNodes(); for (int i = 0; i < nl.getLength(); i++) { Node node = nl.item(i); if (node instanceof Element) { Element childElement = (Element) node; String uri = c...
} } else if (isEmpty(uri)) { if (BEAN_ELEMENT.equals(localName)) { return parseBeanDefinitionElement(childElement, true);
protected Object parseChildExtensionBean(Element element) { NodeList nl = element.getChildNodes(); for (int i = 0; i < nl.getLength(); i++) { Node node = nl.item(i); if (node instanceof Element) { Element childElement = (Element) node; String uri = c...
if (_log != null) { _log.info("target: " + t); }
public void addTarget(LogTarget t) { _targets.add(t); Enumeration s = _sources.elements(); while (s.hasMoreElements()) { LogSource l = (LogSource) s.nextElement(); t.attach(l); } }
InputStream _is = null; try { _is = url.openStream(); t = new URLTemplate(_broker,url); _log.debug("**PARSING "+url); t.parse(); return t; } finally { if (_is != null) _is.close(); }
t = new URLTemplate(_broker,url); _log.debug("**PARSING "+url); t.parse(); return t;
final private Template getTemplate(URL path) { _log.debug("get:"+path); URLTemplate t; String pre = null; String mid = null; String post = null; String pathStr = path.toExternalForm(); try { String[] parts = parseLocalePath(pathStr); S...
if("create".equals(iwc.getParameter(ContentViewer.PARAMETER_CONTENT_RESOURCE))){
if("create".equals(iwc.getParameter(ContentViewer.PARAMETER_ACTION))){
public void encodeBegin(FacesContext context) throws IOException { if(clearOnInit) { //WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "clear"); ArticleItemBean bean = getArticleItemBean(); if(bean!=null){ bean.clear(); } } // WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "updateLocale");// updateEditButtons(); super.e...
buf.append(RESOURCE_DIRECTORY.getAbsolutePath()).append(";");
try { buf.append(RESOURCE_DIRECTORY.getCanonicalPath()).append(";"); } catch (IOException e) { e.printStackTrace(); }
public static void main(final String[] args) { EnhancedDebuggerWindow.PERSISTED_DEBUGGER = true; EnhancedDebuggerWindow.MAX_TABLE_ROWS = 10; XMPPConnection.DEBUG_ENABLED = true; String current = System.getProperty("java.library.path"); String classPath = System.getProperty("java.c...
createException = new MockCreateException();
assertValidServiceContext(serviceContext); this.serviceContext = serviceContext; createException = new MockCreateException("MockCreateException");
public Object createService(ServiceContext serviceContext) { createException = new MockCreateException(); if (throwExceptionFromCreate) throw createException; return super.createService(serviceContext); }
destroyException = new MockDestroyException();
assertSame(this.serviceContext, serviceContext); assertValidServiceContext(serviceContext); destroyException = new MockDestroyException("MockDestroyException");
public void destroyService(ServiceContext serviceContext) { destroyException = new MockDestroyException(); if (throwExceptionFromDestroy) throw destroyException; super.destroyService(serviceContext); }
public Set getStartConditions() {
public synchronized Set getStartConditions() {
public Set getStartConditions() { Set startConditions = new HashSet(super.getStartConditions()); startConditions.add(startCondition); return startConditions; }
public Set getStopConditions() {
public synchronized Set getStopConditions() {
public Set getStopConditions() { Set stopConditions = new HashSet(super.getStopConditions()); stopConditions.add(stopCondition); return stopConditions; }
assertValidEvent(serviceEvent, false);
public void serviceRegistered(ServiceEvent serviceEvent) { registered = serviceEvent; }
assertValidEvent(serviceEvent, true);
public void serviceRunning(ServiceEvent serviceEvent) { running = serviceEvent; }
assertValidEvent(serviceEvent, false);
public void serviceStartError(ServiceEvent serviceEvent) { startError = serviceEvent; }
assertValidEvent(serviceEvent, false);
public void serviceStarting(ServiceEvent serviceEvent) { starting = serviceEvent; }
assertValidEvent(serviceEvent, false);
public void serviceStopError(ServiceEvent serviceEvent) { stopError = serviceEvent; }
assertValidEvent(serviceEvent, false);
public void serviceStopped(ServiceEvent serviceEvent) { stopped = serviceEvent; }
assertValidEvent(serviceEvent, false);
public void serviceStopping(ServiceEvent serviceEvent) { stopping = serviceEvent; }
assertValidEvent(serviceEvent, false);
public void serviceUnregistered(ServiceEvent serviceEvent) { unregistered = serviceEvent; }
assertValidEvent(serviceEvent, false);
public void serviceWaitingToStart(ServiceEvent serviceEvent) { waitingToStart = serviceEvent; }
assertValidEvent(serviceEvent, true);
public void serviceWaitingToStop(ServiceEvent serviceEvent) { waitingToStop = serviceEvent; }
assertValidServiceConditionContext(context);
public void initialize(ServiceConditionContext context) { initializeCalled = true; this.context = context; if (initializedSignal != null) { initializedSignal.countDown(); } }
} else if (serviceFactory.throwExceptionFromDestroy != true) {
} else if (!serviceFactory.throwExceptionFromDestroy) {
private void destroy(StopStrategy stopStrategy) { ServiceState initialState = serviceManager.getState(); serviceMonitor.reset(); startCondition.reset(); stopCondition.reset(); kernel.reset(); try { serviceManager.destroy(stopStrategy); } catch (IllegalServ...
assertEquals(serviceName, e.getServiceName());
private void disabledStart(StartStrategy startStrategy) throws Exception { serviceFactory.setEnabled(false); try { serviceManager.start(false, startStrategy); fail("A disabled service should throw an IllegalServiceStateException from start"); } catch (IllegalServiceStateEx...
assertTrue(serviceFactory.throwExceptionFromCreate == true);
assertTrue(serviceFactory.throwExceptionFromCreate);
private void initialize() throws Exception { long now = System.currentTimeMillis(); // introduce a bit of delay so subsequent times are much less likely to equal to not Thread.sleep(50); serviceMonitor.reset(); startCondition.reset(); stopCondition.reset(); kernel.re...
assertTrue(startCondition.satisfied == false);
assertTrue(!startCondition.satisfied);
private void initialize() throws Exception { long now = System.currentTimeMillis(); // introduce a bit of delay so subsequent times are much less likely to equal to not Thread.sleep(50); serviceMonitor.reset(); startCondition.reset(); stopCondition.reset(); kernel.re...
} else if (serviceFactory.throwExceptionFromCreate != true && startCondition.satisfied == true) {
} else if (!serviceFactory.throwExceptionFromCreate && startCondition.satisfied) {
private void initialize() throws Exception { long now = System.currentTimeMillis(); // introduce a bit of delay so subsequent times are much less likely to equal to not Thread.sleep(50); serviceMonitor.reset(); startCondition.reset(); stopCondition.reset(); kernel.re...
assertEquals(serviceName, e.getServiceName());
private void startException(StartStrategy startStrategy, boolean recursive) throws Exception { serviceFactory.throwExceptionFromCreate = true; try { start(recursive, startStrategy); } catch (MockCreateException e) { assertTrue(startStrategy == StartStrategies.SYNCHRONOUS |...
} catch (IllegalServiceStateException excpected) {
} catch (IllegalServiceStateException e) {
private void startFromStopping(StartStrategy startStrategy) throws Exception { start(false, StartStrategies.ASYNCHRONOUS); stopCondition.satisfied = false; stop(StopStrategies.ASYNCHRONOUS); try { serviceManager.start(false, startStrategy); fail("Should have thrown ...
assertEquals(serviceName, e.getServiceName());
private void startFromStopping(StartStrategy startStrategy) throws Exception { start(false, StartStrategies.ASYNCHRONOUS); stopCondition.satisfied = false; stop(StopStrategies.ASYNCHRONOUS); try { serviceManager.start(false, startStrategy); fail("Should have thrown ...
assertEquals(serviceName, e.getServiceName());
private void startStopsException(StartStrategy startStrategy, StopStrategy stopStrategy) throws Exception { serviceFactory.throwExceptionFromCreate = true; serviceFactory.throwExceptionFromDestroy = true; try { start(false, startStrategy); } catch (MockCreateException e) { ...
assertEquals(serviceName, cause.getServiceName());
private void startWaiting(StartStrategy startStrategy, boolean recursive) throws Exception { startCondition.satisfied = false; try { start(recursive, startStrategy); } catch (UnsatisfiedConditionsException e) { assertTrue(startStrategy == StartStrategies.SYNCHRONOUS); ...
assertEquals(serviceName, cause.getServiceName());
private void startWaitingStart(StartStrategy startStrategy, boolean recursive) throws Exception { startCondition.satisfied = recursive; try { start(recursive, startStrategy); } catch (UnsatisfiedConditionsException e) { assertTrue(startStrategy == StartStrategies.SYNCHRONO...
assertEquals(serviceName, cause.getServiceName());
private void stop(StopStrategy stopStrategy) throws Exception { serviceMonitor.reset(); startCondition.reset(); stopCondition.reset(); kernel.reset(); ServiceState initialState = serviceManager.getState(); serviceManager.stop(stopStrategy); assertSame(serviceName, se...
assertEquals(serviceName, e.getServiceName());
public void waitingStop(StopStrategy stopStrategy) throws Exception { start(false, StartStrategies.SYNCHRONOUS); stopCondition.satisfied = false; try { stop(stopStrategy); } catch (UnsatisfiedConditionsException e) { assertTrue(stopStrategy == StopStrategies.SYNCHRO...
.println(" [\"String\", \"Number\", \"Percentage\", \"Percentage\", \"LocalizedNumber\"]);");
.println(" [\"String\", \"Number\", \"Percentage\", \"Percentage\", \"FormattedNumber\"]);");
private void generateOverview(PackageData packageData) throws IOException { Iterator iter; String filename; if (packageData == null) { filename = "frame-summary.html"; } else { filename = "frame-summary-" + packageData.getName() + ".html"; } File file = new File(destinationDir, filename); PrintStream out...
.println(" [\"String\", \"Percentage\", \"Percentage\", \"LocalizedNumber\"]);");
.println(" [\"String\", \"Percentage\", \"Percentage\", \"FormattedNumber\"]);");
private void generateOverview(PackageData packageData) throws IOException { Iterator iter; String filename; if (packageData == null) { filename = "frame-summary.html"; } else { filename = "frame-summary-" + packageData.getName() + ".html"; } File file = new File(destinationDir, filename); PrintStream out...
+ "<td class=\"value\">" + getDoubleValue(ccn) + "</td>";
+ "<td class=\"value\"><span class=\"hidden\">" + ccn + ";</span>" + getDoubleValue(ccn) + "</td>";
private static String generateTableColumnsFromData(double lineCoverage, double branchCoverage, double ccn) { String lineCoverageCell = (lineCoverage == -1) ? generateNAPercent() : generatePercentResult(lineCoverage); String branchCoverageCell = (branchCoverage == -1) ? generateNAPercent() : generatePer...
g2d.setClip(vButtonShape);
if(!Spark.isMac()){ g2d.setClip(vButtonShape); }
public void paint(Graphics g, JComponent c) { Graphics2D g2d = (Graphics2D)g; g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); Insets vInsets = c.getInsets(); int w = c.getWidth() - (vInsets.left + vInsets.right); int h = c.getHeight() - (v...
public void fileTransferRequest(FileTransferRequest request) { if (fireTransferListeners(request)) { return; } String requestor = request.getRequestor(); String bareJID = StringUtils.parseBareAddress(requestor); ContactItem contactItem = contactList.getContactItemByJID(bareJID); ChatRoom chatRoom; if (contactItem ...
public void fileTransferRequest(final FileTransferRequest request) { SwingUtilities.invokeLater(new Runnable() { public void run() { handleTransferRequest(request, contactList);
private SparkTransferManager() { boolean enabled = Enterprise.containsFeature(Enterprise.FILE_TRANSFER_FEATURE); if (!enabled) { return; } // Register Preferences PreferenceManager prefManager = SparkManager.getPreferenceManager(); prefManager.addPreference(new F...
StyleConstants.setComponent(style, receivingMessageUI); try { doc.insertString(doc.getLength(), "ignored text", style); doc.insertString(doc.getLength(), "\n", null); } catch (BadLocationException e) { Log.error(e); } chatRoom.scrollToBottom(); SparkManager.getChatManager().getChatContainer().fireNotifyOnMessage(ch...
private SparkTransferManager() { boolean enabled = Enterprise.containsFeature(Enterprise.FILE_TRANSFER_FEATURE); if (!enabled) { return; } // Register Preferences PreferenceManager prefManager = SparkManager.getPreferenceManager(); prefManager.addPreference(new F...
public void fileTransferRequest(FileTransferRequest request) { if (fireTransferListeners(request)) { return; } String requestor = request.getRequestor(); String bareJID = StringUtils.parseBareAddress(requestor); ContactItem contactItem = contactList.getContactItemByJID(bareJID); ChatRoom chatRoom; if (contactItem ...
public void fileTransferRequest(final FileTransferRequest request) { SwingUtilities.invokeLater(new Runnable() { public void run() { handleTransferRequest(request, contactList);
public void fileTransferRequest(FileTransferRequest request) { // Check if a listener handled this request if (fireTransferListeners(request)) { return; } String requestor = request.getRequestor(); String bareJID =...
StyleConstants.setComponent(style, receivingMessageUI); try { doc.insertString(doc.getLength(), "ignored text", style); doc.insertString(doc.getLength(), "\n", null); } catch (BadLocationException e) { Log.error(e); } chatRoom.scrollToBottom(); SparkManager.getChatManager().getChatContainer().fireNotifyOnMessage(ch...
public void fileTransferRequest(FileTransferRequest request) { // Check if a listener handled this request if (fireTransferListeners(request)) { return; } String requestor = request.getRequestor(); String bareJID =...
public void actionPerformed(ActionEvent e) { SwingWorker worker = new SwingWorker() { public Object construct() { try { Thread.sleep(10); } catch (InterruptedException e1) { Log.error(e1); } return "delay"; } public void finished() { ChatRoomImpl roomImpl = (ChatRoomImpl)room; getFileChooser().setDialogTitle("Select ...
public void actionPerformed(ActionEvent actionEvent) { sendScreenshot(sendScreenShotButton, room);
public void actionPerformed(ActionEvent e) { SwingWorker worker = new SwingWorker() { public Object construct() { try { Thread.sleep(10); } ...
if (presence == null || presence.getType() == Presence.Type.unavailable) { if (transfer != null) { transfer.cancel();
if (presence != null) { String bareJID = StringUtils.parseBareAddress(presence.getFrom()); List list = (List)waitMap.get(bareJID); if (list != null) { Iterator iter = list.iterator(); ChatRoom room = null; while (iter.hasNext()) { File file = (File)iter.next(); room = sendFile(file, bareJID); } if (room != null) { ...
public void processPacket(Packet packet) { Presence presence = (Presence)packet; if (presence == null || presence.getType() == Presence.Type.unavailable) { if (transfer != null) { transfer.cancel(); } }...
waitMap.remove(bareJID);
public void processPacket(Packet packet) { Presence presence = (Presence)packet; if (presence == null || presence.getType() == Presence.Type.unavailable) { if (transfer != null) { transfer.cancel(); } }...
try { Robot robot = new Robot(); Rectangle area = new Rectangle(Toolkit.getDefaultToolkit().getScreenSize()); return robot.createScreenCapture(area); } catch (AWTException e) { Log.error(e); } return null; }
try { Thread.sleep(10); } catch (InterruptedException e1) { Log.error(e1); } return "delay"; }
public Object construct() { try { Robot robot = new Robot(); Rectangle area = new Rectangle(Toolkit.getDefaultToolkit().getScreenSize()); return robot.createScreenCapture(area); } catch (AWTException e) { ...
BufferedImage bufferedImage = (BufferedImage)get(); if (bufferedImage != null) { sendImage(bufferedImage, room); }
ChatRoomImpl roomImpl = (ChatRoomImpl)room;
public void finished() { BufferedImage bufferedImage = (BufferedImage)get(); if (bufferedImage != null) { sendImage(bufferedImage, room); } button.setEnabled(true); room.setCursor(new Cursor(Cursor.DEFAULT_CURSOR))...
button.setEnabled(true); room.setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); }
getFileChooser().setDialogTitle("Select File(s) to send"); getFileChooser().setMultiSelectionEnabled(true); int ok = getFileChooser().showOpenDialog(roomImpl); if (ok != JFileChooser.APPROVE_OPTION) { return; } File[] file = getFileChooser().getSelectedFiles(); if (file == null || file.length == 0) { return; } final...
public void finished() { BufferedImage bufferedImage = (BufferedImage)get(); if (bufferedImage != null) { sendImage(bufferedImage, room); } button.setEnabled(true); room.setCursor(new Cursor(Cursor.DEFAULT_CURSOR))...
indent -= indentRate;
if (indent > 0) indent--;
void decreaseIndentation() { indent -= indentRate; }
indent += indentRate;
indent++;
void increaseIndentation() { indent += indentRate; }
int i = 0; while (st.hasMoreElements()) {
for (int i=0; st.hasMoreElements(); i++) {
static private String[] tokenize(String list) { StringTokenizer st = new StringTokenizer(list," \t\n\f\r;,"); String[] tokens = new String[st.countTokens()]; int i = 0; while (st.hasMoreElements()) { tokens[i] = st.nextToken(); } return tokens; }
public SoftReferenceObjectPool(PoolableObjectFactory factory) {
public SoftReferenceObjectPool() {
public SoftReferenceObjectPool(PoolableObjectFactory factory) { _pool = new ArrayList(); _factory = factory; }
_factory = factory;
_factory = null;
public SoftReferenceObjectPool(PoolableObjectFactory factory) { _pool = new ArrayList(); _factory = factory; }
int getNumActive() throws UnsupportedOperationException;
int getNumActive(Object key) throws UnsupportedOperationException;
int getNumActive() throws UnsupportedOperationException;
int getNumIdle() throws UnsupportedOperationException;
int getNumIdle(Object key) throws UnsupportedOperationException;
int getNumIdle() throws UnsupportedOperationException;
public static ObjectPool adapt(final KeyedObjectPool keyedPool) throws IllegalArgumentException { return adapt(keyedPool, new Object());
public static PoolableObjectFactory adapt(final KeyedPoolableObjectFactory keyedFactory) throws IllegalArgumentException { return adapt(keyedFactory, new Object());
public static ObjectPool adapt(final KeyedObjectPool keyedPool) throws IllegalArgumentException { return adapt(keyedPool, new Object()); }
public static TimerTask checkMinIdle(final KeyedObjectPool keyedPool, final Object key, final int minIdle, final long period) throws IllegalArgumentException { if (keyedPool == null) {
public static TimerTask checkMinIdle(final ObjectPool pool, final int minIdle, final long period) throws IllegalArgumentException { if (pool == null) {
public static TimerTask checkMinIdle(final KeyedObjectPool keyedPool, final Object key, final int minIdle, final long period) throws IllegalArgumentException { if (keyedPool == null) { throw new IllegalArgumentException("keyedPool must not be null."); } if (key == null) { ...
} if (key == null) { throw new IllegalArgumentException("key must not be null.");
public static TimerTask checkMinIdle(final KeyedObjectPool keyedPool, final Object key, final int minIdle, final long period) throws IllegalArgumentException { if (keyedPool == null) { throw new IllegalArgumentException("keyedPool must not be null."); } if (key == null) { ...
final TimerTask task = new KeyedObjectPoolMinIdleTimerTask(keyedPool, key, minIdle);
final TimerTask task = new ObjectPoolMinIdleTimerTask(pool, minIdle);
public static TimerTask checkMinIdle(final KeyedObjectPool keyedPool, final Object key, final int minIdle, final long period) throws IllegalArgumentException { if (keyedPool == null) { throw new IllegalArgumentException("keyedPool must not be null."); } if (key == null) { ...
public GenericKeyedObjectPool(KeyedPoolableObjectFactory factory) { this(factory,DEFAULT_MAX_ACTIVE,DEFAULT_WHEN_EXHAUSTED_ACTION,DEFAULT_MAX_WAIT,DEFAULT_MAX_IDLE,DEFAULT_TEST_ON_BORROW,DEFAULT_TEST_ON_RETURN,DEFAULT_TIME_BETWEEN_EVICTION_RUNS_MILLIS,DEFAULT_NUM_TESTS_PER_EVICTION_RUN,DEFAULT_MIN_EVICTABLE_IDLE_TIME_M...
public GenericKeyedObjectPool() { this(null,DEFAULT_MAX_ACTIVE,DEFAULT_WHEN_EXHAUSTED_ACTION,DEFAULT_MAX_WAIT,DEFAULT_MAX_IDLE,DEFAULT_TEST_ON_BORROW,DEFAULT_TEST_ON_RETURN,DEFAULT_TIME_BETWEEN_EVICTION_RUNS_MILLIS,DEFAULT_NUM_TESTS_PER_EVICTION_RUN,DEFAULT_MIN_EVICTABLE_IDLE_TIME_MILLIS,DEFAULT_TEST_WHILE_IDLE);
public GenericKeyedObjectPool(KeyedPoolableObjectFactory factory) { this(factory,DEFAULT_MAX_ACTIVE,DEFAULT_WHEN_EXHAUSTED_ACTION,DEFAULT_MAX_WAIT,DEFAULT_MAX_IDLE,DEFAULT_TEST_ON_BORROW,DEFAULT_TEST_ON_RETURN,DEFAULT_TIME_BETWEEN_EVICTION_RUNS_MILLIS,DEFAULT_NUM_TESTS_PER_EVICTION_RUN,DEFAULT_MIN_EVICTABLE_...
public GenericObjectPool(PoolableObjectFactory factory) { this(factory,DEFAULT_MAX_ACTIVE,DEFAULT_WHEN_EXHAUSTED_ACTION,DEFAULT_MAX_WAIT,DEFAULT_MAX_IDLE,DEFAULT_MIN_IDLE,DEFAULT_TEST_ON_BORROW,DEFAULT_TEST_ON_RETURN,DEFAULT_TIME_BETWEEN_EVICTION_RUNS_MILLIS,DEFAULT_NUM_TESTS_PER_EVICTION_RUN,DEFAULT_MIN_EVICTABLE_IDLE...
public GenericObjectPool() { this(null,DEFAULT_MAX_ACTIVE,DEFAULT_WHEN_EXHAUSTED_ACTION,DEFAULT_MAX_WAIT,DEFAULT_MAX_IDLE,DEFAULT_MIN_IDLE,DEFAULT_TEST_ON_BORROW,DEFAULT_TEST_ON_RETURN,DEFAULT_TIME_BETWEEN_EVICTION_RUNS_MILLIS,DEFAULT_NUM_TESTS_PER_EVICTION_RUN,DEFAULT_MIN_EVICTABLE_IDLE_TIME_MILLIS,DEFAULT_TEST_WHILE_...
public GenericObjectPool(PoolableObjectFactory factory) { this(factory,DEFAULT_MAX_ACTIVE,DEFAULT_WHEN_EXHAUSTED_ACTION,DEFAULT_MAX_WAIT,DEFAULT_MAX_IDLE,DEFAULT_MIN_IDLE,DEFAULT_TEST_ON_BORROW,DEFAULT_TEST_ON_RETURN,DEFAULT_TIME_BETWEEN_EVICTION_RUNS_MILLIS,DEFAULT_NUM_TESTS_PER_EVICTION_RUN,DEFAULT_MIN_EVI...
public static KeyedObjectPool checkedPool(final KeyedObjectPool keyedPool, final Class type) { if (keyedPool == null) { throw new IllegalArgumentException("keyedPool must not be null.");
public static ObjectPool checkedPool(final ObjectPool pool, final Class type) { if (pool == null) { throw new IllegalArgumentException("pool must not be null.");
public static KeyedObjectPool checkedPool(final KeyedObjectPool keyedPool, final Class type) { if (keyedPool == null) { throw new IllegalArgumentException("keyedPool must not be null."); } if (type == null) { throw new IllegalArgumentException("type must not be null."); ...
return new CheckedKeyedObjectPool(keyedPool, type);
return new CheckedObjectPool(pool, type);
public static KeyedObjectPool checkedPool(final KeyedObjectPool keyedPool, final Class type) { if (keyedPool == null) { throw new IllegalArgumentException("keyedPool must not be null."); } if (type == null) { throw new IllegalArgumentException("type must not be null."); ...
public static KeyedObjectPool erodingPool(final KeyedObjectPool keyedPool) { return erodingPool(keyedPool, 1f);
public static ObjectPool erodingPool(final ObjectPool pool) { return erodingPool(pool, 1f);
public static KeyedObjectPool erodingPool(final KeyedObjectPool keyedPool) { return erodingPool(keyedPool, 1f); }
public static void prefill(final KeyedObjectPool keyedPool, final Object key, final int count) throws Exception, IllegalArgumentException { if (keyedPool == null) { throw new IllegalArgumentException("keyedPool must not be null."); } if (key == null) { throw new IllegalArgumentException("key must not be null.");
public static void prefill(final ObjectPool pool, final int count) throws Exception, IllegalArgumentException { if (pool == null) { throw new IllegalArgumentException("pool must not be null.");
public static void prefill(final KeyedObjectPool keyedPool, final Object key, final int count) throws Exception, IllegalArgumentException { if (keyedPool == null) { throw new IllegalArgumentException("keyedPool must not be null."); } if (key == null) { throw new IllegalArg...
keyedPool.addObject(key);
pool.addObject();
public static void prefill(final KeyedObjectPool keyedPool, final Object key, final int count) throws Exception, IllegalArgumentException { if (keyedPool == null) { throw new IllegalArgumentException("keyedPool must not be null."); } if (key == null) { throw new IllegalArg...
public static KeyedObjectPool synchronizedPool(final KeyedObjectPool keyedPool) { if (keyedPool == null) { throw new IllegalArgumentException("keyedPool must not be null.");
public static ObjectPool synchronizedPool(final ObjectPool pool) { if (pool == null) { throw new IllegalArgumentException("pool must not be null.");
public static KeyedObjectPool synchronizedPool(final KeyedObjectPool keyedPool) { if (keyedPool == null) { throw new IllegalArgumentException("keyedPool must not be null."); } assert !(keyedPool instanceof GenericKeyedObjectPool) : "GenericKeyedObjectPool is already th...
assert !(keyedPool instanceof GenericKeyedObjectPool) : "GenericKeyedObjectPool is already thread-safe"; assert !(keyedPool instanceof StackKeyedObjectPool) : "StackKeyedObjectPool is already thread-safe"; assert !"org.apache.commons.pool.composite.CompositeKeyedObjectPool".equals(keyedPool.getClass().getName()) : "Com...
assert !(pool instanceof GenericObjectPool) : "GenericObjectPool is already thread-safe"; assert !(pool instanceof SoftReferenceObjectPool) : "SoftReferenceObjectPool is already thread-safe"; assert !(pool instanceof StackObjectPool) : "StackObjectPool is already thread-safe"; assert !"org.apache.commons.pool.composite...
public static KeyedObjectPool synchronizedPool(final KeyedObjectPool keyedPool) { if (keyedPool == null) { throw new IllegalArgumentException("keyedPool must not be null."); } assert !(keyedPool instanceof GenericKeyedObjectPool) : "GenericKeyedObjectPool is already th...
public static KeyedPoolableObjectFactory synchronizedPoolableFactory(final KeyedPoolableObjectFactory keyedFactory) { return new SynchronizedKeyedPoolableObjectFactory(keyedFactory);
public static PoolableObjectFactory synchronizedPoolableFactory(final PoolableObjectFactory factory) { return new SynchronizedPoolableObjectFactory(factory);
public static KeyedPoolableObjectFactory synchronizedPoolableFactory(final KeyedPoolableObjectFactory keyedFactory) { return new SynchronizedKeyedPoolableObjectFactory(keyedFactory); }
assertNotNull(pool);
public void testVariousConstructors() throws Exception { { StackKeyedObjectPool pool = new StackKeyedObjectPool(); } { StackKeyedObjectPool pool = new StackKeyedObjectPool(10); } { StackKeyedObjectPool pool = new StackKeyedObjectPool(10,5); ...
public StackKeyedObjectPool(KeyedPoolableObjectFactory factory, int max) { this(factory,max,DEFAULT_INIT_SLEEPING_CAPACITY);
public StackKeyedObjectPool() { this((KeyedPoolableObjectFactory)null,DEFAULT_MAX_SLEEPING,DEFAULT_INIT_SLEEPING_CAPACITY);
public StackKeyedObjectPool(KeyedPoolableObjectFactory factory, int max) { this(factory,max,DEFAULT_INIT_SLEEPING_CAPACITY); }
public int getNumActive(Object key) { try { return ((Integer)_activeCount.get(key)).intValue(); } catch(NoSuchElementException e) { return 0; } catch(NullPointerException e) { return 0; }
public int getNumActive() { return _totActive;
public int getNumActive(Object key) { try { return ((Integer)_activeCount.get(key)).intValue(); } catch(NoSuchElementException e) { return 0; } catch(NullPointerException e) { return 0; } }
public synchronized int getNumIdle(Object key) { try { return((Stack)(_pools.get(key))).size(); } catch(Exception e) { return 0; }
public int getNumIdle() { return _totIdle;
public synchronized int getNumIdle(Object key) { try { return((Stack)(_pools.get(key))).size(); } catch(Exception e) { return 0; } }
public synchronized Object borrowObject() throws Exception {
public Object borrowObject() throws Exception {
public synchronized Object borrowObject() throws Exception { assertOpen(); long starttime = System.currentTimeMillis(); boolean newlyCreated = false; for(;;) { ObjectTimestampPair pair = null; // if there are any sleeping, just grab one of those try { ...
try { pair = (ObjectTimestampPair)(_pool.removeFirst()); } catch(NoSuchElementException e) { ;
if (!_pool.isEmpty()) { synchronized(this) { try { _numActive++; pair = (ObjectTimestampPair)(_pool.removeFirst()); } catch(NoSuchElementException e) { ; } if(null == pair) { _numActive--; notifyAll(); } }
public synchronized Object borrowObject() throws Exception { assertOpen(); long starttime = System.currentTimeMillis(); boolean newlyCreated = false; for(;;) { ObjectTimestampPair pair = null; // if there are any sleeping, just grab one of those try { ...
Object obj = _factory.makeObject(); pair = new ObjectTimestampPair(obj); newlyCreated = true;
try { _numActive++; Object obj = _factory.makeObject(); pair = new ObjectTimestampPair(obj); newlyCreated = true; } finally { if(null == pair) { synchronized(this) { _numActive--; notifyAll(); } } }
public synchronized Object borrowObject() throws Exception { assertOpen(); long starttime = System.currentTimeMillis(); boolean newlyCreated = false; for(;;) { ObjectTimestampPair pair = null; // if there are any sleeping, just grab one of those try { ...
Object obj = _factory.makeObject(); pair = new ObjectTimestampPair(obj);
try { _numActive++; Object obj = _factory.makeObject(); pair = new ObjectTimestampPair(obj); newlyCreated = true; } finally { if(null == pair) { synchronized(this) { _numActive--; notifyAll(); } } }
public synchronized Object borrowObject() throws Exception { assertOpen(); long starttime = System.currentTimeMillis(); boolean newlyCreated = false; for(;;) { ObjectTimestampPair pair = null; // if there are any sleeping, just grab one of those try { ...
try { if(_maxWait <= 0) { wait();
synchronized(this) { if (_pool.isEmpty()) { try { if(_maxWait <= 0) { wait(); } else { wait(_maxWait); } } catch(InterruptedException e) { } } if(_maxWait > 0 && ((System.currentTimeMillis() - starttime) >= _maxWait)) { throw new NoSuchElementException("Timeout waiting for idle object");
public synchronized Object borrowObject() throws Exception { assertOpen(); long starttime = System.currentTimeMillis(); boolean newlyCreated = false; for(;;) { ObjectTimestampPair pair = null; // if there are any sleeping, just grab one of those try { ...
wait(_maxWait);
continue;
public synchronized Object borrowObject() throws Exception { assertOpen(); long starttime = System.currentTimeMillis(); boolean newlyCreated = false; for(;;) { ObjectTimestampPair pair = null; // if there are any sleeping, just grab one of those try { ...
} catch(InterruptedException e) { } if(_maxWait > 0 && ((System.currentTimeMillis() - starttime) >= _maxWait)) { throw new NoSuchElementException("Timeout waiting for idle object"); } else { continue;
public synchronized Object borrowObject() throws Exception { assertOpen(); long starttime = System.currentTimeMillis(); boolean newlyCreated = false; for(;;) { ObjectTimestampPair pair = null; // if there are any sleeping, just grab one of those try { ...
_numActive++;
public synchronized Object borrowObject() throws Exception { assertOpen(); long starttime = System.currentTimeMillis(); boolean newlyCreated = false; for(;;) { ObjectTimestampPair pair = null; // if there are any sleeping, just grab one of those try { ...
synchronized(this) { _numActive--; notifyAll(); }
public synchronized Object borrowObject() throws Exception { assertOpen(); long starttime = System.currentTimeMillis(); boolean newlyCreated = false; for(;;) { ObjectTimestampPair pair = null; // if there are any sleeping, just grab one of those try { ...
if(_maxActive <= 0 || _numActive < _maxActive) {
if(_maxActive < 0 || _numActive < _maxActive) {
public Object borrowObject() throws Exception { long starttime = System.currentTimeMillis(); boolean newlyCreated = false; for(;;) { ObjectTimestampPair pair = null; synchronized(this) { assertOpen(); // if there are any sleeping, just grab on...
public abstract Object makeObject();
public abstract Object makeObject() throws Exception;
public abstract Object makeObject();
assertNotNull(pool);
public void testVariousConstructors() throws Exception { { StackObjectPool pool = new StackObjectPool(); } { StackObjectPool pool = new StackObjectPool(10); } { StackObjectPool pool = new StackObjectPool(10,5); } { StackObj...
public StackObjectPool(PoolableObjectFactory factory) { this(factory,DEFAULT_MAX_SLEEPING,DEFAULT_INIT_SLEEPING_CAPACITY);
public StackObjectPool() { this((PoolableObjectFactory)null,DEFAULT_MAX_SLEEPING,DEFAULT_INIT_SLEEPING_CAPACITY);
public StackObjectPool(PoolableObjectFactory factory) { this(factory,DEFAULT_MAX_SLEEPING,DEFAULT_INIT_SLEEPING_CAPACITY); }
public MethodCall(final String name, final Object param) { this(name, Collections.singletonList(param));
public MethodCall(final String name) { this(name, null);
public MethodCall(final String name, final Object param) { this(name, Collections.singletonList(param)); }
public TestObjectPoolFactory(final String name) {
protected TestObjectPoolFactory(final String name) {
public TestObjectPoolFactory(final String name) { super(name); }