Modified: ofbiz/trunk/framework/service/src/org/ofbiz/service/engine/HttpEngine.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/service/src/org/ofbiz/service/engine/HttpEngine.java?rev=759240&r1=759239&r2=759240&view=diff ============================================================================== --- ofbiz/trunk/framework/service/src/org/ofbiz/service/engine/HttpEngine.java (original) +++ ofbiz/trunk/framework/service/src/org/ofbiz/service/engine/HttpEngine.java Fri Mar 27 16:58:16 2009 @@ -43,33 +43,33 @@ * HttpEngine.java */ public class HttpEngine extends GenericAsyncEngine { - + public static final String module = HttpEngine.class.getName(); private static final boolean exportAll = false; public HttpEngine(ServiceDispatcher dispatcher) { super(dispatcher); } - + /** * @see org.ofbiz.service.engine.GenericEngine#runSync(java.lang.String, org.ofbiz.service.ModelService, java.util.Map) */ public Map<String, Object> runSync(String localName, ModelService modelService, Map<String, Object> context) throws GenericServiceException { DispatchContext dctx = dispatcher.getLocalContext(localName); String xmlContext = null; - + try { if (Debug.verboseOn()) Debug.logVerbose("Serializing Context --> " + context, module); xmlContext = XmlSerializer.serialize(context); } catch (Exception e) { throw new GenericServiceException("Cannot serialize context.", e); } - + Map<String, Object> parameters = FastMap.newInstance(); parameters.put("serviceName", modelService.invoke); if (xmlContext != null) parameters.put("serviceContext", xmlContext); - + HttpClient http = new HttpClient(this.getLocation(modelService), parameters); String postResult = null; try { @@ -77,7 +77,7 @@ } catch (HttpClientException e) { throw new GenericServiceException("Problems invoking HTTP request", e); } - + Map<String, Object> result = null; try { Object res = XmlSerializer.deserialize(postResult, dctx.getDelegator()); @@ -88,7 +88,7 @@ } catch (Exception e) { throw new GenericServiceException("Problems deserializing result.", e); } - + return result; } @@ -98,7 +98,7 @@ public void runSyncIgnore(String localName, ModelService modelService, Map<String, Object> context) throws GenericServiceException { Map<String, Object> result = runSync(localName, modelService, context); } - + /** * Event for handling HTTP services * @param request HttpServletRequest object @@ -108,20 +108,20 @@ public static String httpEngine(HttpServletRequest request, HttpServletResponse response) { LocalDispatcher dispatcher = (LocalDispatcher) request.getAttribute("dispatcher"); GenericDelegator delegator = (GenericDelegator) request.getAttribute("delegator"); - + String serviceName = request.getParameter("serviceName"); String serviceMode = request.getParameter("serviceMode"); String xmlContext = request.getParameter("serviceContext"); - + Map<String, Object> result = FastMap.newInstance(); Map<String, Object> context = null; - + if (serviceName == null) result.put(ModelService.ERROR_MESSAGE, "Cannot have null service name"); - + if (serviceMode == null) serviceMode = "SYNC"; - + // deserialize the context if (!result.containsKey(ModelService.ERROR_MESSAGE)) { if (xmlContext != null) { @@ -139,7 +139,7 @@ } } } - + // invoke the service if (!result.containsKey(ModelService.ERROR_MESSAGE)) { try { @@ -159,10 +159,10 @@ result.put(ModelService.ERROR_MESSAGE, "Service invocation error: " + e.toString()); } } - + // backup error message StringBuilder errorMessage = new StringBuilder(); - + // process the result String resultString = null; try { @@ -174,12 +174,12 @@ errorMessage.append("::"); errorMessage.append(e); } - + // handle the response try { PrintWriter out = response.getWriter(); response.setContentType("plain/text"); - + if (errorMessage.length() > 0) { response.setContentLength(errorMessage.length()); out.write(errorMessage.toString()); @@ -187,16 +187,16 @@ response.setContentLength(resultString.length()); out.write(resultString); } - + out.flush(); response.flushBuffer(); } catch (IOException e) { Debug.logError(e, "Problems w/ getting the servlet writer.", module); return "error"; } - + return null; } - + } Modified: ofbiz/trunk/framework/service/src/org/ofbiz/service/engine/InterfaceEngine.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/service/src/org/ofbiz/service/engine/InterfaceEngine.java?rev=759240&r1=759239&r2=759240&view=diff ============================================================================== --- ofbiz/trunk/framework/service/src/org/ofbiz/service/engine/InterfaceEngine.java (original) +++ ofbiz/trunk/framework/service/src/org/ofbiz/service/engine/InterfaceEngine.java Fri Mar 27 16:58:16 2009 @@ -29,7 +29,7 @@ * InterfaceEngine.java */ public class InterfaceEngine implements GenericEngine { - + public InterfaceEngine(ServiceDispatcher dispatcher) { } /** Modified: ofbiz/trunk/framework/service/src/org/ofbiz/service/engine/SOAPClientEngine.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/service/src/org/ofbiz/service/engine/SOAPClientEngine.java?rev=759240&r1=759239&r2=759240&view=diff ============================================================================== --- ofbiz/trunk/framework/service/src/org/ofbiz/service/engine/SOAPClientEngine.java (original) +++ ofbiz/trunk/framework/service/src/org/ofbiz/service/engine/SOAPClientEngine.java Fri Mar 27 16:58:16 2009 @@ -49,39 +49,39 @@ * Generic Service SOAP Interface */ public final class SOAPClientEngine extends GenericAsyncEngine { - + public static final String module = SOAPClientEngine.class.getName(); - + public SOAPClientEngine(ServiceDispatcher dispatcher) { super(dispatcher); } - + /** * @see org.ofbiz.service.engine.GenericEngine#runSyncIgnore(java.lang.String, org.ofbiz.service.ModelService, java.util.Map) */ public void runSyncIgnore(String localName, ModelService modelService, Map<String, Object> context) throws GenericServiceException { runSync(localName, modelService, context); } - + /** * @see org.ofbiz.service.engine.GenericEngine#runSync(java.lang.String, org.ofbiz.service.ModelService, java.util.Map) */ public Map<String, Object> runSync(String localName, ModelService modelService, Map<String, Object> context) throws GenericServiceException { Map<String, Object> result = serviceInvoker(modelService, context); - + if (result == null) throw new GenericServiceException("Service did not return expected result"); return result; } - + // Invoke the remote SOAP service private Map<String, Object> serviceInvoker(ModelService modelService, Map<String, Object> context) throws GenericServiceException { if (modelService.location == null || modelService.invoke == null) throw new GenericServiceException("Cannot locate service to invoke"); - + Service service = null; Call call = null; - + try { service = new Service(); call = (Call) service.createCall(); @@ -90,34 +90,34 @@ } catch (ServiceException e) {//Add by Andy.Chen 2003.01.15 throw new GenericServiceException("RPC service error", e); } - + URL endPoint = null; - + try { endPoint = new URL(this.getLocation(modelService)); } catch (MalformedURLException e) { throw new GenericServiceException("Location not a valid URL", e); } - + List<ModelParam> inModelParamList = modelService.getInModelParamList(); - + if (Debug.infoOn()) Debug.logInfo("[SOAPClientEngine.invoke] : Parameter length - " + inModelParamList.size(), module); - + call.setTargetEndpointAddress(endPoint); - + if (UtilValidate.isNotEmpty(modelService.nameSpace)) { call.setOperationName(new QName(modelService.nameSpace, modelService.invoke)); } else { call.setOperationName(modelService.invoke); } - + int i = 0; - + call.setOperation(call.getOperationName().getLocalPart()); List<Object> vParams = new ArrayList<Object>(); for (ModelParam p: inModelParamList) { if (Debug.infoOn()) Debug.logInfo("[SOAPClientEngine.invoke} : Parameter: " + p.name + " (" + p.mode + ") - " + i, module); - + // exclude params that ModelServiceReader insert into (internal params) if (!p.internal) { QName qName = call.getParameterTypeByName(p.name); //.getTypeMapping().getTypeQName((Class) ObjectType.classNameClassMap.get(p.type)); @@ -126,12 +126,12 @@ } i++; } - + call.setReturnType(XMLType.XSD_ANYTYPE); Object[] params=vParams.toArray(new Object[vParams.size()]); - + Object result = null; - + try { Debug.logInfo("[SOAPClientEngine.invoke] : Sending Call To SOAP Server", module); result = call.invoke(params); @@ -144,7 +144,7 @@ return getResponseParams(call.getMessageContext().getResponseMessage()); } - + private Map<String, Object> getResponseParams(Message respMessage) { Map<String, Object> mRet = FastMap.newInstance(); try { @@ -176,7 +176,7 @@ } return mRet; } - + private ParameterMode getMode(String sMode) { if (sMode.equals("IN")) { return ParameterMode.IN; Modified: ofbiz/trunk/framework/service/src/org/ofbiz/service/engine/StandardJavaEngine.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/service/src/org/ofbiz/service/engine/StandardJavaEngine.java?rev=759240&r1=759239&r2=759240&view=diff ============================================================================== --- ofbiz/trunk/framework/service/src/org/ofbiz/service/engine/StandardJavaEngine.java (original) +++ ofbiz/trunk/framework/service/src/org/ofbiz/service/engine/StandardJavaEngine.java Fri Mar 27 16:58:16 2009 @@ -39,7 +39,7 @@ public StandardJavaEngine(ServiceDispatcher dispatcher) { super(dispatcher); } - + /** * @see org.ofbiz.service.engine.GenericEngine#runSyncIgnore(java.lang.String, org.ofbiz.service.ModelService, java.util.Map) */ Modified: ofbiz/trunk/framework/service/src/org/ofbiz/service/group/GroupModel.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/service/src/org/ofbiz/service/group/GroupModel.java?rev=759240&r1=759239&r2=759240&view=diff ============================================================================== --- ofbiz/trunk/framework/service/src/org/ofbiz/service/group/GroupModel.java (original) +++ ofbiz/trunk/framework/service/src/org/ofbiz/service/group/GroupModel.java Fri Mar 27 16:58:16 2009 @@ -38,14 +38,14 @@ * GroupModel.java */ public class GroupModel { - + public static final String module = GroupModel.class.getName(); - + private String groupName, sendMode; private List<GroupServiceModel> services; private boolean optional = false; private int lastServiceRan; - + /** * Constructor using DOM Element * @param group DOM element for the group @@ -74,7 +74,7 @@ if (Debug.verboseOn()) Debug.logVerbose("Created Service Group Model --> " + this, module); } - + /** * Basic Constructor * @param groupName Name of the group @@ -87,7 +87,7 @@ this.sendMode = sendMode; this.services = services; } - + /** * Getter for group name * @return String @@ -95,7 +95,7 @@ public String getGroupName() { return this.groupName; } - + /** * Getter for send mode * @return String @@ -103,7 +103,7 @@ public String getSendMode() { return this.sendMode; } - + /** * Returns a list of services in this group * @return List @@ -111,7 +111,7 @@ public List<GroupServiceModel> getServices() { return this.services; } - + /** * Invokes the group of services in order defined * @param dispatcher ServiceDispatcher used for invocation @@ -136,7 +136,7 @@ throw new GenericServiceException("This mode is not currently supported"); } } - + /** * @see java.lang.Object#toString() */ @@ -149,7 +149,7 @@ str.append(getServices()); return str.toString(); } - + private Map<String, Object> runAll(ServiceDispatcher dispatcher, String localName, Map<String, Object> context) throws GenericServiceException { Map<String, Object> runContext = UtilMisc.makeMapWritable(context); Map<String, Object> result = FastMap.newInstance(); @@ -157,13 +157,13 @@ if (Debug.verboseOn()) Debug.logVerbose("Using Context: " + runContext, module); Map<String, Object> thisResult = model.invoke(dispatcher, localName, runContext); if (Debug.verboseOn()) Debug.logVerbose("Result: " + thisResult, module); - + // make sure we didn't fail if (ServiceUtil.isError(thisResult)) { Debug.logError("Grouped service [" + model.getName() + "] failed.", module); return thisResult; } - + result.putAll(thisResult); if (model.resultToContext()) { runContext.putAll(thisResult); @@ -172,12 +172,12 @@ } return result; } - + private Map<String, Object> runIndex(ServiceDispatcher dispatcher, String localName, Map<String, Object> context, int index) throws GenericServiceException { GroupServiceModel model = services.get(index); return model.invoke(dispatcher, localName, context); } - + private Map<String, Object> runOne(ServiceDispatcher dispatcher, String localName, Map<String, Object> context) throws GenericServiceException { Map<String, Object> result = null; for (GroupServiceModel model: services) { Modified: ofbiz/trunk/framework/service/src/org/ofbiz/service/group/GroupServiceModel.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/service/src/org/ofbiz/service/group/GroupServiceModel.java?rev=759240&r1=759239&r2=759240&view=diff ============================================================================== --- ofbiz/trunk/framework/service/src/org/ofbiz/service/group/GroupServiceModel.java (original) +++ ofbiz/trunk/framework/service/src/org/ofbiz/service/group/GroupServiceModel.java Fri Mar 27 16:58:16 2009 @@ -34,13 +34,13 @@ * GroupServiceModel.java */ public class GroupServiceModel { - + public static final String module = GroupServiceModel.class.getName(); private String serviceName, serviceMode; private boolean resultToContext = false; private boolean optionalParams = false; - + /** * Constructor using DOM element * @param service DOM element for the service @@ -51,7 +51,7 @@ this.resultToContext = service.getAttribute("result-to-context").equalsIgnoreCase("true"); this.optionalParams = service.getAttribute("parameters").equalsIgnoreCase("optional"); } - + /** * Basic constructor * @param serviceName name of the service @@ -61,7 +61,7 @@ this.serviceName = serviceName; this.serviceMode = serviceMode; } - + /** * Getter for the service mode * @return String @@ -69,7 +69,7 @@ public String getMode() { return this.serviceMode; } - + /** * Getter for the service name * @return String @@ -77,7 +77,7 @@ public String getName() { return this.serviceName; } - + /** * Returns true if the results of this service are to go back into the context * @return boolean @@ -93,7 +93,7 @@ public boolean isOptional() { return this.optionalParams; } - + /** * Invoker method to invoke this service * @param dispatcher ServiceDispatcher used for this invocation @@ -107,7 +107,7 @@ ModelService model = dctx.getModelService(getName()); if (model == null) throw new GenericServiceException("Group defined service (" + getName() + ") is not a defined service."); - + Map<String, Object> thisContext = model.makeValid(context, ModelService.IN_PARAM); Debug.logInfo("Running grouped service [" + serviceName + "]", module); if (getMode().equals("async")) { @@ -123,7 +123,7 @@ return dispatcher.runSync(localName, model, thisContext); } } - + /** * @see java.lang.Object#toString() */ Modified: ofbiz/trunk/framework/service/src/org/ofbiz/service/group/ServiceGroupEngine.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/service/src/org/ofbiz/service/group/ServiceGroupEngine.java?rev=759240&r1=759239&r2=759240&view=diff ============================================================================== --- ofbiz/trunk/framework/service/src/org/ofbiz/service/group/ServiceGroupEngine.java (original) +++ ofbiz/trunk/framework/service/src/org/ofbiz/service/group/ServiceGroupEngine.java Fri Mar 27 16:58:16 2009 @@ -49,7 +49,7 @@ if (groupModel == null) { throw new GenericServiceException("GroupModel was null; not a valid ServiceGroup!"); } - + return groupModel.run(dispatcher, localName, context); } Modified: ofbiz/trunk/framework/service/src/org/ofbiz/service/group/ServiceGroupReader.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/service/src/org/ofbiz/service/group/ServiceGroupReader.java?rev=759240&r1=759239&r2=759240&view=diff ============================================================================== --- ofbiz/trunk/framework/service/src/org/ofbiz/service/group/ServiceGroupReader.java (original) +++ ofbiz/trunk/framework/service/src/org/ofbiz/service/group/ServiceGroupReader.java Fri Mar 27 16:58:16 2009 @@ -37,12 +37,12 @@ * ServiceGroupReader.java */ public class ServiceGroupReader { - + public static final String module = ServiceGroupReader.class.getName(); // using a cache is dangerous here because if someone clears it the groups won't work at all: public static UtilCache groupsCache = new UtilCache("service.ServiceGroups", 0, 0, false); public static Map<String, GroupModel> groupsCache = FastMap.newInstance(); - + public static void readConfig() { Element rootElement = null; @@ -63,7 +63,7 @@ addGroupDefinitions(componentResourceInfo.createResourceHandler()); } } - + public static void addGroupDefinitions(ResourceHandler handler) { Element rootElement = null; Modified: ofbiz/trunk/framework/service/src/org/ofbiz/service/jms/AbstractJmsListener.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/service/src/org/ofbiz/service/jms/AbstractJmsListener.java?rev=759240&r1=759239&r2=759240&view=diff ============================================================================== --- ofbiz/trunk/framework/service/src/org/ofbiz/service/jms/AbstractJmsListener.java (original) +++ ofbiz/trunk/framework/service/src/org/ofbiz/service/jms/AbstractJmsListener.java Fri Mar 27 16:58:16 2009 @@ -89,7 +89,7 @@ } if (Debug.verboseOn()) Debug.logVerbose("Running service: " + serviceName, module); - + Map<String, Object> result = null; if (context != null) { try { @@ -109,7 +109,7 @@ MapMessage mapMessage = null; if (Debug.verboseOn()) Debug.logVerbose("JMS Message Received --> " + message, module); - + if (message instanceof MapMessage) { mapMessage = (MapMessage) message; } else { Modified: ofbiz/trunk/framework/service/src/org/ofbiz/service/jms/JmsListenerFactory.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/service/src/org/ofbiz/service/jms/JmsListenerFactory.java?rev=759240&r1=759239&r2=759240&view=diff ============================================================================== --- ofbiz/trunk/framework/service/src/org/ofbiz/service/jms/JmsListenerFactory.java (original) +++ ofbiz/trunk/framework/service/src/org/ofbiz/service/jms/JmsListenerFactory.java Fri Mar 27 16:58:16 2009 @@ -177,7 +177,7 @@ throw new GenericServiceException("No listener found with that serverKey."); loadListener(serverKey, server); } - + /** * Close all the JMS message listeners. * @throws GenericServiceException Modified: ofbiz/trunk/framework/service/src/org/ofbiz/service/jms/JmsServiceEngine.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/service/src/org/ofbiz/service/jms/JmsServiceEngine.java?rev=759240&r1=759239&r2=759240&view=diff ============================================================================== --- ofbiz/trunk/framework/service/src/org/ofbiz/service/jms/JmsServiceEngine.java (original) +++ ofbiz/trunk/framework/service/src/org/ofbiz/service/jms/JmsServiceEngine.java Fri Mar 27 16:58:16 2009 @@ -138,7 +138,7 @@ InitialContext jndi = null; TopicConnectionFactory factory = null; TopicConnection con = null; - + try { jndi = JNDIContextFactory.getInitialContext(serverName); factory = (TopicConnectionFactory) jndi.lookup(jndiName); @@ -155,7 +155,7 @@ throw new GenericServiceException("JNDI lookup problems.", ne); } } - + try { con = factory.createTopicConnection(userName, password); @@ -197,7 +197,7 @@ InitialContext jndi = null; QueueConnectionFactory factory = null; QueueConnection con = null; - + try { jndi = JNDIContextFactory.getInitialContext(serverName); factory = (QueueConnectionFactory) jndi.lookup(jndiName); @@ -214,7 +214,7 @@ throw new GenericServiceException("JNDI lookup problem.", ne2); } } - + try { con = factory.createQueueConnection(userName, password); @@ -251,11 +251,11 @@ String userName = server.getAttribute("username"); String password = server.getAttribute("password"); String clientId = server.getAttribute("client-id"); - + InitialContext jndi = null; XAQueueConnectionFactory factory = null; XAQueueConnection con = null; - + try { jndi = JNDIContextFactory.getInitialContext(serverName); factory = (XAQueueConnectionFactory) jndi.lookup(jndiName); @@ -272,7 +272,7 @@ throw new GenericServiceException("JNDI lookup problems.", ne2); } } - + try { con = factory.createXAQueueConnection(userName, password); Modified: ofbiz/trunk/framework/service/src/org/ofbiz/service/job/JobInvoker.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/service/src/org/ofbiz/service/job/JobInvoker.java?rev=759240&r1=759239&r2=759240&view=diff ============================================================================== --- ofbiz/trunk/framework/service/src/org/ofbiz/service/job/JobInvoker.java (original) +++ ofbiz/trunk/framework/service/src/org/ofbiz/service/job/JobInvoker.java Fri Mar 27 16:58:16 2009 @@ -143,7 +143,7 @@ return 0; } } - + public Long getThreadId() { if (this.thread != null) { return this.thread.getId(); @@ -228,7 +228,7 @@ } } else { Debug.logInfo("Invoker [" + thread.getName() + "] received job [" + job.getJobName() + "] from poller [" + jp.toString() + "]", module); - + // setup the current job settings this.currentJob = job; this.statusCode = 1; Modified: ofbiz/trunk/framework/service/src/org/ofbiz/service/job/JobManager.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/service/src/org/ofbiz/service/job/JobManager.java?rev=759240&r1=759239&r2=759240&view=diff ============================================================================== --- ofbiz/trunk/framework/service/src/org/ofbiz/service/job/JobManager.java (original) +++ ofbiz/trunk/framework/service/src/org/ofbiz/service/job/JobManager.java Fri Mar 27 16:58:16 2009 @@ -141,9 +141,9 @@ Debug.logError("Unable to poll for jobs; transaction was not started by this process", module); return null; } - + List<Job> localPoll = FastList.newInstance(); - + // first update the jobs w/ this instance running information delegator.storeByCondition("JobSandbox", updateFields, mainCondition); @@ -169,7 +169,7 @@ } else { pollDone = true; } - + // nothing should go wrong at this point, so add to the general list poll.addAll(localPoll); } catch (Throwable t) { @@ -224,7 +224,7 @@ Timestamp now = UtilDateTime.nowTimestamp(); // only re-schedule if there is no new recurrences since last run Debug.log("Scheduling Job : " + job, module); - + String pJobId = job.getString("parentJobId"); if (pJobId == null) { pJobId = job.getString("jobId"); @@ -237,17 +237,17 @@ newJob.set("startDateTime", null); newJob.set("runByInstanceId", null); delegator.createSetNextSeqId(newJob); - + // set the cancel time on the old job to the same as the re-schedule time job.set("statusId", "SERVICE_CRASHED"); job.set("cancelDateTime", now); delegator.store(job); - + rescheduled++; } } } - + if (Debug.infoOn()) Debug.logInfo("-- " + rescheduled + " jobs re-scheduled", module); } catch (GenericEntityException e) { Debug.logError(e, module); Modified: ofbiz/trunk/framework/service/src/org/ofbiz/service/job/JobManagerException.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/service/src/org/ofbiz/service/job/JobManagerException.java?rev=759240&r1=759239&r2=759240&view=diff ============================================================================== --- ofbiz/trunk/framework/service/src/org/ofbiz/service/job/JobManagerException.java (original) +++ ofbiz/trunk/framework/service/src/org/ofbiz/service/job/JobManagerException.java Fri Mar 27 16:58:16 2009 @@ -22,7 +22,7 @@ * Job Scheduler Exception */ public class JobManagerException extends org.ofbiz.base.util.GeneralException { - + /** * Creates new <code>JobManagerException</code> without detail message. */ Modified: ofbiz/trunk/framework/service/src/org/ofbiz/service/job/JobPoller.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/service/src/org/ofbiz/service/job/JobPoller.java?rev=759240&r1=759239&r2=759240&view=diff ============================================================================== --- ofbiz/trunk/framework/service/src/org/ofbiz/service/job/JobPoller.java (original) +++ ofbiz/trunk/framework/service/src/org/ofbiz/service/job/JobPoller.java Fri Mar 27 16:58:16 2009 @@ -187,7 +187,7 @@ */ public void queueNow(Job job) { //Debug.logInfo("[" + Thread.currentThread().getId() + "] Begin queueNow; holds run lock? " + Thread.holdsLock(run), module); - + // NOTE DEJ20071201 MUST use a different object for the lock here because the "this" object is always held by the poller thread in the run method above (which sleeps and runs) synchronized (run) { run.add(job); @@ -198,7 +198,7 @@ if (run.size() > pool.size() && pool.size() < maxThreads()) { int calcSize = (run.size() / jobsPerThread()) - (pool.size()); int addSize = calcSize > maxThreads() ? maxThreads() : calcSize; - + for (int i = 0; i < addSize; i++) { JobInvoker iv = new JobInvoker(this, invokerWaitTime()); pool.add(iv); Modified: ofbiz/trunk/framework/service/src/org/ofbiz/service/mail/JavaMailContainer.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/service/src/org/ofbiz/service/mail/JavaMailContainer.java?rev=759240&r1=759239&r2=759240&view=diff ============================================================================== --- ofbiz/trunk/framework/service/src/org/ofbiz/service/mail/JavaMailContainer.java (original) +++ ofbiz/trunk/framework/service/src/org/ofbiz/service/mail/JavaMailContainer.java Fri Mar 27 16:58:16 2009 @@ -84,7 +84,7 @@ String dispatcherName = ContainerConfig.getPropertyValue(cfg, "dispatcher-name", "JavaMailDispatcher"); String delegatorName = ContainerConfig.getPropertyValue(cfg, "delegator-name", "default"); this.deleteMail = "true".equals(ContainerConfig.getPropertyValue(cfg, "delete-mail", "false")); - + this.delegator = GenericDelegator.getGenericDelegator(delegatorName); this.dispatcher = GenericDispatcher.getLocalDispatcher(dispatcherName, delegator); this.timerDelay = (long) ContainerConfig.getPropertyValue(cfg, "poll-delay", 300000); Modified: ofbiz/trunk/framework/service/src/org/ofbiz/service/mail/ServiceMcaRule.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/service/src/org/ofbiz/service/mail/ServiceMcaRule.java?rev=759240&r1=759239&r2=759240&view=diff ============================================================================== --- ofbiz/trunk/framework/service/src/org/ofbiz/service/mail/ServiceMcaRule.java (original) +++ ofbiz/trunk/framework/service/src/org/ofbiz/service/mail/ServiceMcaRule.java Fri Mar 27 16:58:16 2009 @@ -65,7 +65,7 @@ Debug.logInfo("Service MCA [" + ruleName + "] is disabled; not running.", module); return; } - + boolean allCondTrue = true; for (ServiceMcaCondition cond: conditions) { if (!cond.eval(dispatcher, messageWrapper, userLogin)) { Modified: ofbiz/trunk/framework/service/src/org/ofbiz/service/rmi/RemoteDispatcher.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/service/src/org/ofbiz/service/rmi/RemoteDispatcher.java?rev=759240&r1=759239&r2=759240&view=diff ============================================================================== --- ofbiz/trunk/framework/service/src/org/ofbiz/service/rmi/RemoteDispatcher.java (original) +++ ofbiz/trunk/framework/service/src/org/ofbiz/service/rmi/RemoteDispatcher.java Fri Mar 27 16:58:16 2009 @@ -30,7 +30,7 @@ * Generic Services Remote Dispatcher */ public interface RemoteDispatcher extends Remote { - + /** * Run the service synchronously and return the result. * @param serviceName Name of the service to run. @@ -158,7 +158,7 @@ * @throws RemoteException */ public void schedule(String serviceName, Map<String, ? extends Object> context, long startTime, int frequency, int interval, int count, long endTime) throws GenericServiceException, RemoteException; - + /** * Schedule a service to run asynchronously at a specific start time. * @param serviceName Name of the service to invoke. @@ -171,7 +171,7 @@ * @throws RemoteException */ public void schedule(String serviceName, Map<String, ? extends Object> context, long startTime, int frequency, int interval, int count) throws GenericServiceException, RemoteException; - + /** * Schedule a service to run asynchronously at a specific start time. * @param serviceName Name of the service to invoke. @@ -184,7 +184,7 @@ * @throws RemoteException */ public void schedule(String serviceName, Map<String, ? extends Object> context, long startTime, int frequency, int interval, long endTime) throws GenericServiceException, RemoteException; - + /** * Schedule a service to run asynchronously at a specific start time. * @param serviceName Name of the service to invoke. Modified: ofbiz/trunk/framework/service/src/org/ofbiz/service/rmi/RmiServiceContainer.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/service/src/org/ofbiz/service/rmi/RmiServiceContainer.java?rev=759240&r1=759239&r2=759240&view=diff ============================================================================== --- ofbiz/trunk/framework/service/src/org/ofbiz/service/rmi/RmiServiceContainer.java (original) +++ ofbiz/trunk/framework/service/src/org/ofbiz/service/rmi/RmiServiceContainer.java Fri Mar 27 16:58:16 2009 @@ -52,7 +52,7 @@ public void init(String[] args, String configFile) { this.configFile = configFile; } - + public boolean start() throws ContainerException { // get the container config ContainerConfig.Container cfg = ContainerConfig.getContainer("rmi-dispatcher", configFile); Modified: ofbiz/trunk/framework/service/src/org/ofbiz/service/rmi/socket/ssl/SSLServerSocketFactory.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/service/src/org/ofbiz/service/rmi/socket/ssl/SSLServerSocketFactory.java?rev=759240&r1=759239&r2=759240&view=diff ============================================================================== --- ofbiz/trunk/framework/service/src/org/ofbiz/service/rmi/socket/ssl/SSLServerSocketFactory.java (original) +++ ofbiz/trunk/framework/service/src/org/ofbiz/service/rmi/socket/ssl/SSLServerSocketFactory.java Fri Mar 27 16:58:16 2009 @@ -89,7 +89,7 @@ if (alias == null) { throw new IOException("SSL certificate alias cannot be null; MUST be set for SSLServerSocketFactory!"); } - + javax.net.ssl.SSLServerSocketFactory factory = null; try { if (ks != null) { Modified: ofbiz/trunk/framework/service/src/org/ofbiz/service/semaphore/ServiceSemaphore.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/service/src/org/ofbiz/service/semaphore/ServiceSemaphore.java?rev=759240&r1=759239&r2=759240&view=diff ============================================================================== --- ofbiz/trunk/framework/service/src/org/ofbiz/service/semaphore/ServiceSemaphore.java (original) +++ ofbiz/trunk/framework/service/src/org/ofbiz/service/semaphore/ServiceSemaphore.java Fri Mar 27 16:58:16 2009 @@ -48,7 +48,7 @@ if (mode == SEMAPHORE_MODE_NONE) return; lockTime = UtilDateTime.nowTimestamp(); - + if (this.checkLockNeedToWait()) { waitOrFail(); } @@ -60,7 +60,7 @@ // remove the lock file dbWrite(lock, true); } - + private void waitOrFail() throws SemaphoreWaitException, SemaphoreFailException { if (SEMAPHORE_MODE_FAIL == mode) { // fail @@ -113,7 +113,7 @@ // use the special method below so we can reuse the unqiue tx functions dbWrite(semaphore, false); - + // we own the lock, no waiting return false; } else { Modified: ofbiz/trunk/framework/service/src/org/ofbiz/service/test/ServiceEngineTestServices.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/service/src/org/ofbiz/service/test/ServiceEngineTestServices.java?rev=759240&r1=759239&r2=759240&view=diff ============================================================================== --- ofbiz/trunk/framework/service/src/org/ofbiz/service/test/ServiceEngineTestServices.java (original) +++ ofbiz/trunk/framework/service/src/org/ofbiz/service/test/ServiceEngineTestServices.java Fri Mar 27 16:58:16 2009 @@ -38,7 +38,7 @@ public class ServiceEngineTestServices { public static final String module = ServiceEngineTestServices.class.getName(); - + public static Map<String, Object> testServiceDeadLockRetry(DispatchContext dctx, Map<String, ? extends Object> context) { LocalDispatcher dispatcher = dctx.getDispatcher(); try { @@ -63,10 +63,10 @@ Debug.logError(e, errMsg, module); return ServiceUtil.returnError(errMsg); } - + return ServiceUtil.returnSuccess(); } - + public static Map<String, Object> testServiceDeadLockRetryThreadA(DispatchContext dctx, Map<String, ? extends Object> context) { GenericDelegator delegator = dctx.getDelegator(); @@ -75,7 +75,7 @@ GenericValue testingTypeA = delegator.findOne("TestingType", false, "testingTypeId", "SVCLRT_A"); testingTypeA.set("description", "New description for SVCLRT_A"); testingTypeA.store(); - + // wait at least long enough for the other method to have locked resource B Debug.logInfo("In testServiceDeadLockRetryThreadA just updated SVCLRT_A, beginning wait", module); UtilMisc.staticWait(100); @@ -109,7 +109,7 @@ GenericValue testingTypeB = delegator.findOne("TestingType", false, "testingTypeId", "SVCLRT_B"); testingTypeB.set("description", "New description for SVCLRT_B"); testingTypeB.store(); - + // wait at least long enough for the other method to have locked resource B Debug.logInfo("In testServiceDeadLockRetryThreadB just updated SVCLRT_B, beginning wait", module); UtilMisc.staticWait(100); @@ -137,7 +137,7 @@ } // ================================================== - + public static Map<String, Object> testServiceLockWaitTimeoutRetry(DispatchContext dctx, Map<String, ? extends Object> context) { LocalDispatcher dispatcher = dctx.getDispatcher(); try { @@ -162,7 +162,7 @@ Debug.logError(e, errMsg, module); return ServiceUtil.returnError(errMsg); } - + return ServiceUtil.returnSuccess(); } public static Map<String, Object> testServiceLockWaitTimeoutRetryGrabber(DispatchContext dctx, Map<String, ? extends Object> context) { @@ -175,7 +175,7 @@ testingType.store(); Debug.logInfo("In testServiceLockWaitTimeoutRetryGrabber just updated SVCLWTRT, beginning wait", module); - + // wait at least long enough for the other method to have locked resource wait time out // (tx timeout 6s on this the Grabber and 2s on the Waiter): wait 4 seconds because timeout on this UtilMisc.staticWait(4 * 1000); @@ -197,14 +197,14 @@ try { // wait for a small amount of time to make sure the grabber does it's thing first UtilMisc.staticWait(100); - + Debug.logInfo("In testServiceLockWaitTimeoutRetryWaiter about to update SVCLWTRT, wait starts here", module); - + // TRY grab entity SVCLWTRT by looking up and changing, should get a lock wait timeout exception because of the Grabber thread GenericValue testingType = delegator.findOne("TestingType", false, "testingTypeId", "SVCLWTRT"); testingType.set("description", "New description for SVCLWTRT from Waiter service, this is the value that should be there."); testingType.store(); - + Debug.logInfo("In testServiceLockWaitTimeoutRetryWaiter successfully updated SVCLWTRT", module); } catch (GenericEntityException e) { String errMsg = "Entity Engine Exception running lock wait timeout test Waiter thread: " + e.toString(); @@ -220,7 +220,7 @@ } // ================================================== - + /** * NOTE that this is a funny case where the auto-retry in the service engine for the call to * testServiceLockWaitTimeoutRetryCantRecoverWaiter would NOT be able to recover because it would try again @@ -252,7 +252,7 @@ if (ServiceUtil.isError(waiterResult)) { return ServiceUtil.returnError("Error running testServiceLockWaitTimeoutRetryCantRecoverWaiter", null, null, waiterResult); } - + Debug.logInfo("In testServiceLockWaitTimeoutRetryCantRecover (grabber) successfully finished running sub-service in own transaction", module); } catch (GenericServiceException e) { String errMsg = "Error running deadlock test services: " + e.toString(); @@ -262,7 +262,7 @@ Debug.logError(e, errMsg, module); return ServiceUtil.returnError(errMsg); } - + return ServiceUtil.returnSuccess(); } public static Map<String, Object> testServiceLockWaitTimeoutRetryCantRecoverWaiter(DispatchContext dctx, Map<String, ? extends Object> context) { @@ -275,7 +275,7 @@ GenericValue testingType = delegator.findOne("TestingType", false, "testingTypeId", "SVCLWTRTCR"); testingType.set("description", "New description for SVCLWTRTCR from Lock Wait Timeout Lock Waiter, this is the value that should be there."); testingType.store(); - + Debug.logInfo("In testServiceLockWaitTimeoutRetryCantRecoverWaiter successfully updated SVCLWTRTCR", module); } catch (GenericEntityException e) { String errMsg = "Entity Engine Exception running lock wait timeout test Waiter thread: " + e.toString(); @@ -285,9 +285,9 @@ return ServiceUtil.returnSuccess(); } - + // ================================================== - + public static Map<String, Object> testServiceOwnTxSubServiceAfterSetRollbackOnlyInParentErrorCatchWrapper(DispatchContext dctx, Map<String, ? extends Object> context) { LocalDispatcher dispatcher = dctx.getDispatcher(); try { @@ -299,7 +299,7 @@ String errMsg = "This is the expected error running sub-service with own tx after the parent has set rollback only, logging and ignoring: " + e.toString(); Debug.logError(e, errMsg, module); } - + return ServiceUtil.returnSuccess(); } public static Map<String, Object> testServiceOwnTxSubServiceAfterSetRollbackOnlyInParent(DispatchContext dctx, Map<String, ? extends Object> context) { @@ -310,9 +310,9 @@ GenericValue testingType = delegator.findOne("TestingType", false, "testingTypeId", "SVC_SRBO"); testingType.set("description", "New description for SVC_SRBO; this should be reset on the rollback, if this is in the db then the test failed"); testingType.store(); - + TransactionUtil.setRollbackOnly("Intentionally setting rollback only for testing purposes", null); - + Map<String, Object> resultMap = dispatcher.runSync("testServiceOwnTxSubServiceAfterSetRollbackOnlyInParentSubService", null, 60, true); if (ServiceUtil.isError(resultMap)) { return ServiceUtil.returnError("Error running sub-service in testServiceOwnTxSubServiceAfterSetRollbackOnlyInParent", null, null, resultMap); @@ -322,17 +322,17 @@ Debug.logError(e, errMsg, module); return ServiceUtil.returnError(errMsg); } - + return ServiceUtil.returnSuccess(); } public static Map<String, Object> testServiceOwnTxSubServiceAfterSetRollbackOnlyInParentSubService(DispatchContext dctx, Map<String, ? extends Object> context) { // this service doesn't actually have to do anything, the problem was in just pausing and resuming the transaciton with setRollbackOnly return ServiceUtil.returnSuccess(); } - - + + // ================================================== - + public static Map<String, Object> testServiceEcaGlobalEventExec(DispatchContext dctx, Map<String, ? extends Object> context) { LocalDispatcher dispatcher = dctx.getDispatcher(); try { @@ -343,7 +343,7 @@ Debug.logError(e, errMsg, module); return ServiceUtil.returnError(errMsg); } - + // this service doesn't actually have to do anything, just a placeholder for ECA rules, this one should commit return ServiceUtil.returnSuccess(); } |
Free forum by Nabble | Edit this page |