public static BatchletProxy createBatchletProxy(String id, InjectionReferences injectionRefs, RuntimeStepExecution stepContext) throws ArtifactValidationException { Batchlet loadedArtifact = (Batchlet)loadArtifact(id, injectionRefs); BatchletProxy proxy = new BatchletProxy(loadedArtifact); proxy.setStepContext(stepContext); return proxy; }
@Override public void stop() { StopLock stopLock = getStopLock(); // Store in local variable to facilitate Ctrl+Shift+G search in Eclipse synchronized (stopLock) { if ( isStepStartingOrStarted() ) { markStepStopping(); // Possible for stop() to come before process(). See comment above. if (batchletProxy != null) { batchletProxy.stop(); } } else { // Might not be set up yet to have a state. logger.fine("Ignoring stop, since step not in a state which has a valid status (might not be far enough along to have a state yet)"); } } }
private void invokeBatchlet(Batchlet batchlet) throws BatchContainerServiceException { String batchletId = batchlet.getRef(); List<Property> propList = (batchlet.getProperties() == null) ? null : batchlet.getProperties().getPropertyList(); String sourceMethod = "invokeBatchlet"; if (logger.isLoggable(Level.FINER)) { logger.entering(sourceClass, sourceMethod, batchletId); } String exitStatus = null; InjectionReferences injectionRef = new InjectionReferences(jobExecutionImpl.getJobContext(), stepContext, propList); try { batchletProxy = ProxyFactory.createBatchletProxy(batchletId, injectionRef, stepContext); } catch (ArtifactValidationException e) { throw new BatchContainerServiceException("Cannot create the batchlet [" + batchletId + "]", e); } if (logger.isLoggable(Level.FINE)) logger.fine("Batchlet is loaded and validated: " + batchletProxy); if (wasStopIssued()) { logger.fine("Exit without executing batchlet since stop() request has been received."); } else { logger.fine("Starting process() for the Batchlet Artifact"); String processRetVal = batchletProxy.process(); logger.fine("Set process() return value = " + processRetVal + " for possible use as exitStatus"); stepContext.setBatchletProcessRetVal(processRetVal); logger.exiting(sourceClass, sourceMethod, exitStatus==null ? "<null>" : exitStatus); } }
@Override public synchronized void stop() { // It is possible for stop() to be issued before process() if (BatchStatus.STARTING.equals(stepContext.getBatchStatus()) || BatchStatus.STARTED.equals(stepContext.getBatchStatus())) { stepContext.setBatchStatus(BatchStatus.STOPPING); if (batchletProxy != null) { batchletProxy.stop(); } } else { //TODO do we need to throw an error if the batchlet is already stopping/stopped //a stop gets issued twice } }
String processRetVal = batchletProxy.process();
public static BatchletProxy createBatchletProxy(String id, InjectionReferences injectionRefs, StepContextImpl stepContext) throws ArtifactValidationException { Batchlet loadedArtifact = (Batchlet)loadArtifact(id, injectionRefs); BatchletProxy proxy = new BatchletProxy(loadedArtifact); proxy.setStepContext(stepContext); return proxy; }
@Override public synchronized void stop() { // It is possible for stop() to be issued before process() if (BatchStatus.STARTING.equals(stepContext.getBatchStatus()) || BatchStatus.STARTED.equals(stepContext.getBatchStatus())) { stepContext.setBatchStatus(BatchStatus.STOPPING); if (batchletProxy != null) { batchletProxy.stop(); } } else { //TODO do we need to throw an error if the batchlet is already stopping/stopped //a stop gets issued twice } }
private void invokeBatchlet(Batchlet batchlet) throws BatchContainerServiceException { String batchletId = batchlet.getRef(); List<Property> propList = (batchlet.getProperties() == null) ? null : batchlet.getProperties().getPropertyList(); String sourceMethod = "invokeBatchlet"; if (logger.isLoggable(Level.FINER)) { logger.entering(sourceClass, sourceMethod, batchletId); } String exitStatus = null; InjectionReferences injectionRef = new InjectionReferences(jobExecutionImpl.getJobContext(), stepContext, propList); try { batchletProxy = ProxyFactory.createBatchletProxy(batchletId, injectionRef, stepContext); } catch (ArtifactValidationException e) { throw new BatchContainerServiceException("Cannot create the batchlet [" + batchletId + "]", e); } if (logger.isLoggable(Level.FINE)) logger.fine("Batchlet is loaded and validated: " + batchletProxy); if (wasStopIssued()) { logger.fine("Exit without executing batchlet since stop() request has been received."); } else { String processRetVal = batchletProxy.process(); logger.fine("Set process() return value = " + processRetVal + " for possible use as exitStatus"); stepContext.setBatchletProcessRetVal(processRetVal); logger.exiting(sourceClass, sourceMethod, exitStatus==null ? "<null>" : exitStatus); } }
public static BatchletProxy createBatchletProxy(String id, InjectionReferences injectionRefs, StepContextImpl stepContext) throws ArtifactValidationException { Batchlet loadedArtifact = (Batchlet)loadArtifact(id, injectionRefs); BatchletProxy proxy = new BatchletProxy(loadedArtifact); proxy.setStepContext(stepContext); return proxy; }