protected TimeZone getTimeZone() { return controller.getConfig().getTimeZone(); } });
/** Called, when the worker did its job. Frees resources and * decrements the number of concurrent requests. * @param pWorker The worker being released. */ public synchronized void releaseWorker(XmlRpcWorker pWorker) { --numThreads; int max = controller.getMaxThreads(); if (pWorker == singleton) { // Do nothing, it's the singleton } else { if (pool.size() < max) { pool.add(pWorker); } } }
/** Performs a request with the clients default configuration. * @param pRequest The request being performed. * @return The result object. * @throws XmlRpcException Performing the request failed. */ public Object execute(XmlRpcRequest pRequest) throws XmlRpcException { return getWorkerFactory().getWorker().execute(pRequest); }
protected Object readResponse(XmlRpcStreamRequestConfig pConfig, InputStream pStream) throws XmlRpcException { InputSource isource = new InputSource(pStream); XMLReader xr = newXMLReader(); XmlRpcResponseParser xp; try { xp = new XmlRpcResponseParser(pConfig, getClient().getTypeFactory()); xr.setContentHandler(xp); xr.parse(isource); } catch (SAXException e) { throw new XmlRpcClientException("Failed to parse servers response: " + e.getMessage(), e); } catch (IOException e) { throw new XmlRpcClientException("Failed to read servers response: " + e.getMessage(), e); } if (xp.isSuccess()) { return xp.getResult(); } else { throw new XmlRpcException(xp.getErrorCode(), xp.getErrorMessage()); } } }
/** Performs a request with the clients default configuration. * @param pRequest The request being performed. * @param pCallback The callback being notified when the request is finished. * @throws XmlRpcException Performing the request failed. */ public void executeAsync(XmlRpcRequest pRequest, AsyncCallback pCallback) throws XmlRpcException { XmlRpcClientWorker w = (XmlRpcClientWorker) getWorkerFactory().getWorker(); w.execute(pRequest, pCallback); }
/** Writes the requests uncompressed XML data to the given * output stream. Ensures, that the output stream is being * closed. */ public void write(OutputStream pStream) throws XmlRpcException, IOException, SAXException { final XmlRpcStreamConfig config = (XmlRpcStreamConfig) request.getConfig(); try { ContentHandler h = getClient().getXmlWriterFactory().getXmlWriter(config, pStream); XmlRpcWriter xw = new XmlRpcWriter(config, h, getClient().getTypeFactory()); xw.write(request); pStream.close(); pStream = null; } finally { if (pStream != null) { try { pStream.close(); } catch (Throwable ignore) {} } } } }
protected TimeZone getTimeZone() { return controller.getConfig().getTimeZone(); } });
/** Called, when the worker did its job. Frees resources and * decrements the number of concurrent requests. * @param pWorker The worker being released. */ public synchronized void releaseWorker(XmlRpcWorker pWorker) { --numThreads; int max = controller.getMaxThreads(); if (pWorker == singleton) { // Do nothing, it's the singleton } else { if (pool.size() < max) { pool.add(pWorker); } } }
protected TimeZone getTimeZone() { return controller.getConfig().getTimeZone(); } });
/** Called, when the worker did its job. Frees resources and * decrements the number of concurrent requests. * @param pWorker The worker being released. */ public synchronized void releaseWorker(XmlRpcWorker pWorker) { --numThreads; int max = controller.getMaxThreads(); if (pWorker == singleton) { // Do nothing, it's the singleton } else { if (pool.size() < max) { pool.add(pWorker); } } }
protected TimeZone getTimeZone() { return controller.getConfig().getTimeZone(); } });
/** Returns a worker for synchronous processing. * @return An instance of {@link XmlRpcWorker}, which is ready * for use. * @throws XmlRpcLoadException The clients maximum number of concurrent * threads is exceeded. */ public synchronized XmlRpcWorker getWorker() throws XmlRpcLoadException { int max = controller.getMaxThreads(); if (max > 0 && numThreads == max) { throw new XmlRpcLoadException("Maximum number of concurrent requests exceeded: " + max); } if (max == 0) { return singleton; } ++numThreads; if (pool.size() == 0) { return newWorker(); } else { return (XmlRpcWorker) pool.remove(pool.size() - 1); } }
protected TimeZone getTimeZone() { return controller.getConfig().getTimeZone(); } });
/** Returns a worker for synchronous processing. * @return An instance of {@link XmlRpcWorker}, which is ready * for use. * @throws XmlRpcLoadException The clients maximum number of concurrent * threads is exceeded. */ public synchronized XmlRpcWorker getWorker() throws XmlRpcLoadException { int max = controller.getMaxThreads(); if (max > 0 && numThreads == max) { throw new XmlRpcLoadException("Maximum number of concurrent requests exceeded: " + max); } if (max == 0) { return singleton; } ++numThreads; if (pool.size() == 0) { return newWorker(); } else { return (XmlRpcWorker) pool.remove(pool.size() - 1); } }
protected TimeZone getTimeZone() { return controller.getConfig().getTimeZone(); } });
/** Returns a worker for synchronous processing. * @return An instance of {@link XmlRpcWorker}, which is ready * for use. * @throws XmlRpcLoadException The clients maximum number of concurrent * threads is exceeded. */ public synchronized XmlRpcWorker getWorker() throws XmlRpcLoadException { int max = controller.getMaxThreads(); if (max > 0 && numThreads == max) { throw new XmlRpcLoadException("Maximum number of concurrent requests exceeded: " + max); } if (max == 0) { return singleton; } ++numThreads; if (pool.size() == 0) { return newWorker(); } else { return (XmlRpcWorker) pool.remove(pool.size() - 1); } }