You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ode.apache.org by ms...@apache.org on 2007/09/19 01:55:21 UTC

svn commit: r577112 - in /ode/trunk: bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/ bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/bom/ bpel-obj/src/main/java/org/apache/ode/bpel/o/ bpel-runtime/src/main/java/org/apache/ode/bpel/ru...

Author: mszefler
Date: Tue Sep 18 16:55:20 2007
New Revision: 577112

URL: http://svn.apache.org/viewvc?rev=577112&view=rev
Log:
Serializable Scopes
Fix compiler activitygenerators that were not reporting variables read/written
Fix ProcessManagementTest

Modified:
    ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/BpelCompiler.java
    ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/CommonCompilationMessages.java
    ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/InvokeGenerator.java
    ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/PickGenerator.java
    ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/PickReceiveGenerator.java
    ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/ReceiveGenerator.java
    ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/ReplyGenerator.java
    ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/ThrowGenerator.java
    ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/bom/Scope.java
    ode/trunk/bpel-obj/src/main/java/org/apache/ode/bpel/o/OScope.java
    ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/PROCESS.java
    ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/SCOPEACT.java
    ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/ScopeFrame.java
    ode/trunk/bpel-runtime/src/test/java/org/apache/ode/bpel/runtime/MockBpelServer.java
    ode/trunk/jacob/src/main/java/org/apache/ode/jacob/JacobObject.java

Modified: ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/BpelCompiler.java
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/BpelCompiler.java?rev=577112&r1=577111&r2=577112&view=diff
==============================================================================
--- ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/BpelCompiler.java (original)
+++ ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/BpelCompiler.java Tue Sep 18 16:55:20 2007
@@ -117,9 +117,8 @@
 import java.util.Stack;
 
 /**
- * Compiler for converting BPEL process descriptions (and their associated WSDL
- * and XSD documents) into compiled representations suitable for execution by
- * the ODE BPEL Service Provider. TODO: Move process validation into this class.
+ * Compiler for converting BPEL process descriptions (and their associated WSDL and XSD documents) into compiled representations
+ * suitable for execution by the ODE BPEL Service Provider. TODO: Move process validation into this class.
  */
 abstract class BpelCompiler implements CompilerContext {
     /** Class-severity logger. */
@@ -136,8 +135,12 @@
 
     private boolean _supressJoinFailure = false;
 
+    /** Are we currently in an atomic scope context? */
     private boolean _atomicScope = false;
 
+    /** Are we currently compiling an isolated scope context. */
+    private boolean _isolatedScope = false;
+
     /** Syntactic scope stack. */
     private StructureStack _structureStack = new StructureStack();
 
@@ -181,8 +184,8 @@
             WSDLLocatorImpl locator = new WSDLLocatorImpl(_resourceFinder, from.resolve(wsdlImport));
             def = (Definition4BPEL) r.readWSDL(locator);
         } catch (WSDLException e) {
-            recoveredFromError(sloc, new CompilationException(__cmsgs.errWsdlParseError(e
-                    .getFaultCode(), e.getLocation(), e.getMessage())));
+            recoveredFromError(sloc, new CompilationException(__cmsgs.errWsdlParseError(e.getFaultCode(), e.getLocation(), e
+                    .getMessage())));
             throw new CompilationException(__cmsgs.errWsdlImportFailed(wsdlImport.toASCIIString(), e.getFaultCode())
                     .setSource(sloc), e);
         }
@@ -200,8 +203,7 @@
         URI resFrom = from.resolve(location);
         if (__log.isDebugEnabled())
             __log.debug("Adding XSD import from " + resFrom + " location " + location);
-        XMLEntityResolver resolver = new WsdlFinderXMLEntityResolver(_resourceFinder,
-                location, new HashMap<URI,String>(), true);
+        XMLEntityResolver resolver = new WsdlFinderXMLEntityResolver(_resourceFinder, location, new HashMap<URI, String>(), true);
         try {
             Map<URI, byte[]> schemas = XSUtils.captureSchema(resFrom.toString(), resolver);
             InputStream xsdStream = _resourceFinder.openResource(resFrom);
@@ -214,13 +216,13 @@
             schemas.put(resFrom, data);
             _wsdlRegistry.addSchemas(schemas);
         } catch (XsdException e) {
-            CompilationException ce =  new CompilationException(__cmsgs.errInvalidImport(location.toString()));
+            CompilationException ce = new CompilationException(__cmsgs.errInvalidImport(location.toString()));
             recoveredFromError(sloc, ce);
         } catch (MalformedURLException e) {
-            CompilationException ce =  new CompilationException(__cmsgs.errInvalidImport(location.toString()));
+            CompilationException ce = new CompilationException(__cmsgs.errInvalidImport(location.toString()));
             recoveredFromError(sloc, ce);
         } catch (IOException e) {
-            CompilationException ce =  new CompilationException(__cmsgs.errInvalidImport(location.toString()));
+            CompilationException ce = new CompilationException(__cmsgs.errInvalidImport(location.toString()));
             recoveredFromError(sloc, ce);
         }
     }
@@ -351,7 +353,7 @@
         if (scopeToComp == null)
             throw new CompilationException(__cmsgs.errCompensateOfInvalidScope(scopeToCompensate));
 
-        return scopeToComp; 
+        return scopeToComp;
     }
 
     public String getSourceLocation() {
@@ -422,8 +424,8 @@
         OMessageVarType msgVarType = (OMessageVarType) var.type;
         OMessageVarType.Part part = msgVarType.parts.get(partname);
         if (part == null)
-            throw new CompilationException(__cmsgs.errUndeclaredMessagePart(var.name,
-                    ((OMessageVarType) var.type).messageType, partname));
+            throw new CompilationException(__cmsgs.errUndeclaredMessagePart(var.name, ((OMessageVarType) var.type).messageType,
+                    partname));
         return part;
     }
 
@@ -464,8 +466,8 @@
                 });
 
         if (found == null)
-            throw new CompilationException(__cmsgs.errUndeclaredOperation(partnerLink.partnerRolePortType.getQName(),
-                    operationName));
+            throw new CompilationException(__cmsgs
+                    .errUndeclaredOperation(partnerLink.partnerRolePortType.getQName(), operationName));
         return found;
     }
 
@@ -486,15 +488,13 @@
                     }
                 });
         if (found == null) {
-            throw new CompilationException(__cmsgs.errUndeclaredOperation(partnerLink.myRolePortType.getQName(),
-                    operationName));
+            throw new CompilationException(__cmsgs.errUndeclaredOperation(partnerLink.myRolePortType.getQName(), operationName));
         }
         return found;
     }
 
     /**
-     * Produce a boolean {@link OExpression} expression that returns a constant
-     * value.
+     * Produce a boolean {@link OExpression} expression that returns a constant value.
      * 
      * @param value
      *            constant value to return
@@ -522,7 +522,8 @@
     public OExpression compileExpr(String expr, NSContext nc) {
         // Does this really work?
         BpelObject cur = _structureStack.topSource();
-        return compileExpr(new Expression11(cur.getElement(),cur.getElement().getOwnerDocument().createTextNode(expr)),false,false);
+        return compileExpr(new Expression11(cur.getElement(), cur.getElement().getOwnerDocument().createTextNode(expr)), false,
+                false);
     }
 
     private OExpression compileExpr(Expression expression, boolean isJoinCondition, boolean isLValue) {
@@ -547,7 +548,7 @@
 
             // Cleaning up expression compiler for furter compilation
             ec.setCompilerContext(null);
-            
+
             return oexpr;
         } catch (CompilationException ce) {
             if (ce.getCompilationMessage().source == null)
@@ -597,7 +598,7 @@
     public OProcess compile(final Process process, ResourceFinder rf) throws CompilationException {
         if (process == null)
             throw new NullPointerException("Null process parameter");
-        
+
         setResourceFinder(rf);
         _processURI = process.getURI();
         _processDef = process;
@@ -623,21 +624,21 @@
         _oprocess.guid = new GUID().toString();
         _oprocess.constants = makeConstants();
         _oprocess.debugInfo = createDebugInfo(process, "process");
-        
+
         if (process.getTargetNamespace() == null) {
             _oprocess.targetNamespace = "--UNSPECIFIED--";
             recoveredFromError(process, new CompilationException(__cmsgs.errProcessNamespaceNotSpecified()));
         } else {
             _oprocess.targetNamespace = _processDef.getTargetNamespace();
         }
-        
+
         if (process.getName() == null) {
             _oprocess.processName = "--UNSPECIFIED--";
             recoveredFromError(process, new CompilationException(__cmsgs.errProcessNameNotSpecified()));
         } else {
             _oprocess.processName = _processDef.getName();
         }
-        
+
         _oprocess.compileDate = _generatedDate;
 
         _konstExprLang = new OExpressionLanguage(_oprocess, null);
@@ -761,32 +762,22 @@
     // }
 
     /**
-     * Compile an import declaration. According to the specification:
-     * <blockquote> A BPEL4WSWS-BPEL process definition relies on XML Schema and
-     * WSDL 1.1 for the definition of datatypes and service interfaces. Process
-     * definitions also rely on other constructs such as partner link types,
-     * message properties and property aliases (defined later in this
-     * specification) which are defined within WSDL 1.1 documents using the WSDL
-     * 1.1 language extensibility feature.
+     * Compile an import declaration. According to the specification: <blockquote> A BPEL4WSWS-BPEL process definition relies on XML
+     * Schema and WSDL 1.1 for the definition of datatypes and service interfaces. Process definitions also rely on other constructs
+     * such as partner link types, message properties and property aliases (defined later in this specification) which are defined
+     * within WSDL 1.1 documents using the WSDL 1.1 language extensibility feature.
      * 
-     * The &lt;import&gt; element is used within a BPEL4WSWS-BPEL process to
-     * explicitly indicate a dependency on external XML Schema or WSDL
-     * definitions. Any number of <import> elements may appear as initial
-     * children of the <process> element, before any other child element. Each
-     * <import> element contains three mandatory attributes:
+     * The &lt;import&gt; element is used within a BPEL4WSWS-BPEL process to explicitly indicate a dependency on external XML Schema
+     * or WSDL definitions. Any number of <import> elements may appear as initial children of the <process> element, before any
+     * other child element. Each <import> element contains three mandatory attributes:
      * <ol>
-     * <li>namespace -- The namespace attribute specifies the URI namespace of
-     * the imported definitions. </li>
-     * <li>location -- The location attribute contains a URI indicating the
-     * location of a document that contains relevant definitions in the
-     * namespace specified. The document located at the URI MUST contain
-     * definitions belonging to the same namespace as indicated by the namespace
-     * attribute. </li>
-     * <li>importType -- The importType attribute identifies the type of
-     * document being imported by providing the URI of the encoding language.
-     * The value MUST be set to "http://www.w3.org/2001/XMLSchema" when
-     * importing XML Schema 1.0 documents, and to
-     * "http://schemas.xmlsoap.org/wsdl/" when importing WSDL 1.1 documents.
+     * <li>namespace -- The namespace attribute specifies the URI namespace of the imported definitions. </li>
+     * <li>location -- The location attribute contains a URI indicating the location of a document that contains relevant
+     * definitions in the namespace specified. The document located at the URI MUST contain definitions belonging to the same
+     * namespace as indicated by the namespace attribute. </li>
+     * <li>importType -- The importType attribute identifies the type of document being imported by providing the URI of the
+     * encoding language. The value MUST be set to "http://www.w3.org/2001/XMLSchema" when importing XML Schema 1.0 documents, and
+     * to "http://schemas.xmlsoap.org/wsdl/" when importing WSDL 1.1 documents.
      * 
      * @param imprt
      *            BOM representation of the import
@@ -828,8 +819,8 @@
 
         OActivity compiled;
         try {
-            compiled = (source instanceof ScopeLikeActivity) ? compileSLC((ScopeLikeActivity) source,
-                    new OScope.Variable[0]) : compileActivity(true, source);
+            compiled = (source instanceof ScopeLikeActivity) ? compileSLC((ScopeLikeActivity) source, new OScope.Variable[0])
+                    : compileActivity(true, source);
             compiled.suppressJoinFailure = _supressJoinFailure;
         } finally {
             _supressJoinFailure = previousSupressJoinFailure;
@@ -899,8 +890,8 @@
         for (LinkTarget lt : source.getLinkTargets())
             compileLinkTarget(lt);
 
-        _structureStack.topActivity().joinCondition = (source.getJoinCondition() == null || source.getLinkTargets()
-                .isEmpty()) ? null : compileJoinCondition(source.getJoinCondition());
+        _structureStack.topActivity().joinCondition = (source.getJoinCondition() == null || source.getLinkTargets().isEmpty()) ? null
+                : compileJoinCondition(source.getJoinCondition());
     }
 
     private String createName(Activity source, String type) {
@@ -931,11 +922,9 @@
         OProcess.OProperty property = resolveProperty(src.getPropertyName());
 
         OProcess.OPropertyAlias alias = new OProcess.OPropertyAlias(_oprocess);
-        alias.debugInfo = createDebugInfo(_processDef, "PropertyAlias " + src.getPropertyName() + " for "
-                + src.getMessageType());
-        if (src.getMessageType() == null){
-            throw new CompilationException(__cmsgs.errAliasUndeclaredMessage(src.getPropertyName(),
-                    src.getQuery().getPath()));
+        alias.debugInfo = createDebugInfo(_processDef, "PropertyAlias " + src.getPropertyName() + " for " + src.getMessageType());
+        if (src.getMessageType() == null) {
+            throw new CompilationException(__cmsgs.errAliasUndeclaredMessage(src.getPropertyName(), src.getQuery().getPath()));
         }
 
         OMessageVarType messageType = resolveMessageType(src.getMessageType());
@@ -945,8 +934,7 @@
         if (src.getPart() != null) {
             alias.part = messageType.parts.get(src.getPart());
             if (alias.part == null)
-                throw new CompilationException(__cmsgs.errUnknownPartInAlias(src.getPart(),
-                        messageType.messageType.toString()));
+                throw new CompilationException(__cmsgs.errUnknownPartInAlias(src.getPart(), messageType.messageType.toString()));
         }
         if (src.getQuery() != null)
             alias.location = compileExpr(src.getQuery());
@@ -996,7 +984,8 @@
                 oplink.myRoleName = myRole.getName();
                 QName portType = myRole.getPortType();
                 if (portType == null)
-                    throw new CompilationException(__cmsgs.errMissingMyRolePortType(portType, plink.getMyRole(), plinkType.getName()));
+                    throw new CompilationException(__cmsgs.errMissingMyRolePortType(portType, plink.getMyRole(), plinkType
+                            .getName()));
                 oplink.myRolePortType = resolvePortType(portType);
             }
 
@@ -1006,12 +995,12 @@
             if (plink.hasPartnerRole()) {
                 PartnerLinkType.Role partnerRole = plinkType.getRole(plink.getPartnerRole());
                 if (partnerRole == null)
-                    throw new CompilationException(__cmsgs.errUndeclaredRole(plink.getPartnerRole(), plinkType
-                            .getName()));
+                    throw new CompilationException(__cmsgs.errUndeclaredRole(plink.getPartnerRole(), plinkType.getName()));
                 oplink.partnerRoleName = partnerRole.getName();
                 QName portType = partnerRole.getPortType();
                 if (portType == null)
-                    throw new CompilationException(__cmsgs.errMissingPartnerRolePortType(portType, plink.getPartnerRole(), plinkType.getName()));
+                    throw new CompilationException(__cmsgs.errMissingPartnerRolePortType(portType, plink.getPartnerRole(),
+                            plinkType.getName()));
                 oplink.partnerRolePortType = resolvePortType(portType);
             }
 
@@ -1044,7 +1033,7 @@
 
     public void compile(OActivity context, BpelObject source, Runnable run) {
         DefaultActivityGenerator.defaultExtensibilityElements(context, source);
-        _structureStack.push(context,source);
+        _structureStack.push(context, source);
         try {
             run.run();
         } finally {
@@ -1086,9 +1075,19 @@
             boolean newValue = src.getAtomicScope().booleanValue();
             if (_atomicScope)
                 throw new CompilationException(__cmsgs.errAtomicScopeNesting(newValue));
-            
+
             oscope.atomicScope = _atomicScope = newValue;
         }
+
+        if (src.getIsolatedScope() != null) {
+            if (src.getIsolatedScope()) {
+                if (_isolatedScope)
+                    throw new CompilationException(__cmsgs.errIsolatedScopeNesting());
+
+                oscope.isolatedScope = _isolatedScope = true;
+            }
+        }
+
         try {
             compile(oscope, src, new Runnable() {
                 public void run() {
@@ -1227,11 +1226,9 @@
                 case BPEL20_DRAFT:
                 case BPEL20:
                     if (onEvent.getMessageType() == null && onEvent.getElementType() == null)
-                        throw new CompilationException(__cmsgs.errVariableDeclMissingType(onEvent.getVariable())
-                                .setSource(onEvent));
+                        throw new CompilationException(__cmsgs.errVariableDeclMissingType(onEvent.getVariable()).setSource(onEvent));
                     if (onEvent.getMessageType() != null && onEvent.getElementType() != null)
-                        throw new CompilationException(__cmsgs.errVariableDeclInvalid(onEvent.getVariable()).setSource(
-                                onEvent));
+                        throw new CompilationException(__cmsgs.errVariableDeclInvalid(onEvent.getVariable()).setSource(onEvent));
 
                     OVarType varType;
                     if (onEvent.getMessageType() != null)
@@ -1239,8 +1236,7 @@
                     else if (onEvent.getElement() != null)
                         varType = resolveElementType(onEvent.getElementType());
                     else
-                        throw new CompilationException(__cmsgs
-                                .errUnrecognizedVariableDeclaration(onEvent.getVariable()));
+                        throw new CompilationException(__cmsgs.errUnrecognizedVariableDeclaration(onEvent.getVariable()));
 
                     oevent.variable = new OScope.Variable(_oprocess, varType);
                     oevent.variable.name = onEvent.getVariable();
@@ -1256,8 +1252,7 @@
                 oevent.operation = resolveMyRoleOperation(oevent.partnerLink, onEvent.getOperation());
                 oevent.messageExchangeId = onEvent.getMessageExchangeId();
 
-                if (onEvent.getPortType() != null
-                        && !onEvent.getPortType().equals(oevent.partnerLink.myRolePortType.getQName()))
+                if (onEvent.getPortType() != null && !onEvent.getPortType().equals(oevent.partnerLink.myRolePortType.getQName()))
                     throw new CompilationException(__cmsgs.errPortTypeMismatch(onEvent.getPortType(),
                             oevent.partnerLink.myRolePortType.getQName()));
 
@@ -1359,8 +1354,7 @@
         oscope.terminationHandler.debugInfo = createDebugInfo(terminationHandler, null);
         if (terminationHandler == null) {
             oscope.terminationHandler.activity = createDefaultCompensateActivity(null,
-                    "Auto-generated 'compensate all' pseudo-activity for default termination handler on "
-                            + oscope.toString());
+                    "Auto-generated 'compensate all' pseudo-activity for default termination handler on " + oscope.toString());
         } else {
             _recoveryContextStack.push(oscope);
             try {
@@ -1378,8 +1372,7 @@
         oscope.compensationHandler.debugInfo = createDebugInfo(compensationHandler, null);
         if (compensationHandler == null) {
             oscope.compensationHandler.activity = createDefaultCompensateActivity(compensationHandler,
-                    "Auto-generated 'compensate all' pseudo-activity for default compensation handler on  "
-                            + oscope.toString());
+                    "Auto-generated 'compensate all' pseudo-activity for default compensation handler on  " + oscope.toString());
         } else {
             _recoveryContextStack.push(oscope);
             try {
@@ -1453,8 +1446,8 @@
                                     else if (catchSrc.getFaultVariableElementType() != null)
                                         faultVarType = resolveElementType(catchSrc.getFaultVariableElementType());
                                     else
-                                        throw new CompilationException(__cmsgs
-                                                .errUnrecognizedVariableDeclaration(catchSrc.getFaultVariable()));
+                                        throw new CompilationException(__cmsgs.errUnrecognizedVariableDeclaration(catchSrc
+                                                .getFaultVariable()));
 
                                     faultVar = new OScope.Variable(_oprocess, faultVarType);
                                     faultVar.name = catchSrc.getFaultVariable();
@@ -1463,8 +1456,7 @@
                                     ctch.addLocalVariable(faultVar);
                                     break;
                                 default:
-                                    throw new AssertionError("Unexpected BPEL VERSION constatnt: "
-                                            + _processDef.getBpelVersion());
+                                    throw new AssertionError("Unexpected BPEL VERSION constatnt: " + _processDef.getBpelVersion());
                                 }
 
                                 ctch.faultVariable = faultVar;
@@ -1490,7 +1482,7 @@
         } catch (URISyntaxException e) {
             throw new CompilationException(__cmsgs.errInvalidDocXsltUri(docStrUri));
         }
-        
+
         String sheetBody = loadXsltSheet(_processURI.resolve(docUri));
         if (sheetBody == null) {
             throw new CompilationException(__cmsgs.errCantFindXslt(docStrUri));
@@ -1627,11 +1619,12 @@
 
     private static class StructureStack {
         private Stack<OActivity> _stack = new Stack<OActivity>();
-        private Map<OActivity,BpelObject> _srcMap = new HashMap<OActivity,BpelObject>();
-        
+
+        private Map<OActivity, BpelObject> _srcMap = new HashMap<OActivity, BpelObject>();
+
         public void push(OActivity act, BpelObject src) {
             _stack.push(act);
-            _srcMap.put(act,src);
+            _srcMap.put(act, src);
         }
 
         public BpelObject topSource() {

Modified: ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/CommonCompilationMessages.java
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/CommonCompilationMessages.java?rev=577112&r1=577111&r2=577112&view=diff
==============================================================================
--- ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/CommonCompilationMessages.java (original)
+++ ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/CommonCompilationMessages.java Tue Sep 18 16:55:20 2007
@@ -438,6 +438,10 @@
             return this.formatCompilationMessage("A scope enclosed inside an atomic scope cannot declare itself as not atomic");
     }
 
+    public CompilationMessage errIsolatedScopeNesting() {
+        return this.formatCompilationMessage("Cannot nest isolated scopes.");
+    }
+
     public CompilationMessage errProcessNameNotSpecified() {
         return this.formatCompilationMessage("The process name was not specified.");
     }

Modified: ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/InvokeGenerator.java
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/InvokeGenerator.java?rev=577112&r1=577111&r2=577112&view=diff
==============================================================================
--- ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/InvokeGenerator.java (original)
+++ ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/InvokeGenerator.java Tue Sep 18 16:55:20 2007
@@ -66,6 +66,7 @@
                     throw new CompilationException(__imsgs.errInvokeNoInputMessageForInputOp(oinvoke.operation.getName()));
                 oinvoke.inputVar = _context.resolveMessageVariable(src.getInputVar(), oinvoke.operation.getInput().getMessage()
                         .getQName());
+                oinvoke.variableRd.add(oinvoke.inputVar);
             }
         }
         if (oinvoke.operation.getOutput() != null && oinvoke.operation.getOutput().getMessage() != null) {
@@ -73,6 +74,7 @@
                 throw new CompilationException(__imsgs.errInvokeNoOutputMessageForOutputOp(oinvoke.operation.getName()));
             oinvoke.outputVar = _context.resolveMessageVariable(src.getOutputVar(), oinvoke.operation.getOutput().getMessage()
                     .getQName());
+            oinvoke.variableWr.add(oinvoke.outputVar);
         }
         List<Correlation> correlations = src.getCorrelations();
         List<Correlation> incorrelations = CollectionsX.filter(new ArrayList<Correlation>(), correlations,

Modified: ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/PickGenerator.java
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/PickGenerator.java?rev=577112&r1=577111&r2=577112&view=diff
==============================================================================
--- ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/PickGenerator.java (original)
+++ ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/PickGenerator.java Tue Sep 18 16:55:20 2007
@@ -51,6 +51,8 @@
               sOnMessage.getCorrelations());
       oOnMessage.activity = _context.compile(sOnMessage.getActivity());
       opick.onMessages.add(oOnMessage);
+      if (oOnMessage.variable != null)
+          opick.variableWr.add(oOnMessage.variable);
     }
 
     try {

Modified: ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/PickReceiveGenerator.java
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/PickReceiveGenerator.java?rev=577112&r1=577111&r2=577112&view=diff
==============================================================================
--- ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/PickReceiveGenerator.java (original)
+++ ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/PickReceiveGenerator.java Tue Sep 18 16:55:20 2007
@@ -68,9 +68,10 @@
         OPickReceive.OnMessage onMessage = new OPickReceive.OnMessage(_context.getOProcess());
         onMessage.partnerLink = _context.resolvePartnerLink(plink);
         onMessage.operation = _context.resolveMyRoleOperation(onMessage.partnerLink, operation);
-        if (onMessage.operation.getInput() != null && onMessage.operation.getInput().getMessage() != null)
+        if (onMessage.operation.getInput() != null && onMessage.operation.getInput().getMessage() != null) {
             onMessage.variable = _context.resolveMessageVariable(varname, onMessage.operation.getInput().getMessage()
                     .getQName());
+        }
         onMessage.messageExchangeId = messageExchangeId;
 
         if (portType != null && !portType.equals(onMessage.partnerLink.myRolePortType.getQName()))

Modified: ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/ReceiveGenerator.java
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/ReceiveGenerator.java?rev=577112&r1=577111&r2=577112&view=diff
==============================================================================
--- ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/ReceiveGenerator.java (original)
+++ ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/ReceiveGenerator.java Tue Sep 18 16:55:20 2007
@@ -42,6 +42,8 @@
 
     onMessage.activity = new OEmpty(_context.getOProcess(), opick);
     opick.onMessages.add(onMessage);
+    if (onMessage.variable != null)
+        opick.variableWr.add(onMessage.variable);
   }
 
 }

Modified: ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/ReplyGenerator.java
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/ReplyGenerator.java?rev=577112&r1=577111&r2=577112&view=diff
==============================================================================
--- ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/ReplyGenerator.java (original)
+++ ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/ReplyGenerator.java Tue Sep 18 16:55:20 2007
@@ -56,6 +56,7 @@
         oreply.messageExchangeId = replyDef.getMessageExchangeId();
         if (replyDef.getVariable() != null) {
             oreply.variable = _context.resolveVariable(replyDef.getVariable());
+            oreply.variableRd.add(oreply.variable);
             if (!(oreply.variable.type instanceof OMessageVarType))
                 throw new CompilationException(_cmsgsGeneral.errMessageVariableRequired(oreply.variable.name));
         }

Modified: ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/ThrowGenerator.java
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/ThrowGenerator.java?rev=577112&r1=577111&r2=577112&view=diff
==============================================================================
--- ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/ThrowGenerator.java (original)
+++ ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/ThrowGenerator.java Tue Sep 18 16:55:20 2007
@@ -37,7 +37,9 @@
         ThrowActivity throwDef = (ThrowActivity)src;
         OThrow othrow = (OThrow) output;
         othrow.faultName = throwDef.getFaultName();
-        if(throwDef.getFaultVariable() != null)
+        if(throwDef.getFaultVariable() != null) {
             othrow.faultVariable = _context.resolveVariable(throwDef.getFaultVariable());
+            othrow.variableRd.add(othrow.faultVariable);
+        }
     }
 }

Modified: ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/bom/Scope.java
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/bom/Scope.java?rev=577112&r1=577111&r2=577112&view=diff
==============================================================================
--- ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/bom/Scope.java (original)
+++ ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/bom/Scope.java Tue Sep 18 16:55:20 2007
@@ -21,7 +21,6 @@
 import java.util.Collections;
 import java.util.List;
 
-import javax.xml.namespace.QName;
 
 import org.apache.ode.utils.stl.CollectionsX;
 import org.apache.ode.utils.stl.MemberOfFunction;
@@ -162,7 +161,15 @@
             return Boolean.FALSE;
         return null;
     }
-
+    
+    public Boolean getIsolatedScope() {
+        String value = getAttribute("isolated", "no");
+        if ("yes".equals(value))
+            return Boolean.TRUE;
+        if ("no".equals(value))
+            return Boolean.FALSE;
+        return null;
+    }
     /**
      * Get a partnerLink declared in this scope.
      * 

Modified: ode/trunk/bpel-obj/src/main/java/org/apache/ode/bpel/o/OScope.java
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-obj/src/main/java/org/apache/ode/bpel/o/OScope.java?rev=577112&r1=577111&r2=577112&view=diff
==============================================================================
--- ode/trunk/bpel-obj/src/main/java/org/apache/ode/bpel/o/OScope.java (original)
+++ ode/trunk/bpel-obj/src/main/java/org/apache/ode/bpel/o/OScope.java Tue Sep 18 16:55:20 2007
@@ -60,7 +60,11 @@
 
     public boolean implicitScope;
 
+    /** Is this scope <em>atomic</em> i.e. meant to execute in a single transaction. */
     public boolean atomicScope;
+
+    /** Is this scope <em>isolated</em> i.e. protected against concurrent access to its variables. */
+    public boolean isolatedScope;
 
     public OScope(OProcess owner, OActivity parent) {
         super(owner, parent);

Modified: ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/PROCESS.java
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/PROCESS.java?rev=577112&r1=577111&r2=577112&view=diff
==============================================================================
--- ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/PROCESS.java (original)
+++ ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/PROCESS.java Tue Sep 18 16:55:20 2007
@@ -19,12 +19,15 @@
 package org.apache.ode.bpel.runtime;
 
 import org.apache.ode.bpel.evt.ProcessInstanceStartedEvent;
+import org.apache.ode.bpel.o.OBase;
 import org.apache.ode.bpel.o.OProcess;
 import org.apache.ode.bpel.o.OScope;
 import org.apache.ode.bpel.o.OFailureHandling;
+import org.apache.ode.bpel.o.OScope.Variable;
 import org.apache.ode.bpel.runtime.channels.FaultData;
 import org.apache.ode.bpel.runtime.channels.ParentScopeChannel;
 import org.apache.ode.bpel.runtime.channels.ParentScopeChannelListener;
+import org.apache.ode.bpel.runtime.channels.ReadWriteLockChannel;
 import org.apache.ode.bpel.runtime.channels.TerminationChannel;
 import org.apache.ode.jacob.SynchChannel;
 
@@ -34,6 +37,7 @@
 public class PROCESS extends BpelJacobRunnable {
     private static final long serialVersionUID = 1L;
     private OProcess _oprocess;
+    private InstanceGlobals _globals;
 
     public PROCESS(OProcess process) {
         _oprocess = process;
@@ -43,6 +47,7 @@
         BpelRuntimeContext ntive = getBpelRuntimeContext();
         Long scopeInstanceId = ntive.createScopeInstance(null, _oprocess.procesScope);
 
+        createGlobals();
         ProcessInstanceStartedEvent evt = new ProcessInstanceStartedEvent();
         evt.setRootScopeId(scopeInstanceId);
         evt.setScopeDeclarationId(_oprocess.procesScope.getId());
@@ -51,7 +56,7 @@
         ActivityInfo child = new ActivityInfo(genMonotonic(),
             _oprocess.procesScope,
             newChannel(TerminationChannel.class), newChannel(ParentScopeChannel.class));
-        ScopeFrame processFrame = new ScopeFrame(_oprocess.procesScope, scopeInstanceId, null, null);
+        ScopeFrame processFrame = new ScopeFrame(_oprocess.procesScope, scopeInstanceId, null, null,_globals);
         instance(new SCOPE(child, processFrame, new LinkFrame(null)));
 
         object(new ParentScopeChannelListener(child.parent) {
@@ -79,5 +84,19 @@
                 this.completed(faultData, CompensationHandler.emptySet());
             }
         });
+    }
+
+    private void createGlobals() {
+        _globals = new InstanceGlobals();
+        
+        // For each variable, we create a lock.
+        for (OBase child : _oprocess.getChildren()) 
+            if (child instanceof OScope.Variable) {
+                OScope.Variable var = (Variable) child;
+                ReadWriteLockChannel vlock = newChannel(ReadWriteLockChannel.class);
+                instance(new READWRITELOCK(vlock));
+                _globals._varLocks.put(var, vlock);
+                
+            }
     }
 }

Modified: ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/SCOPEACT.java
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/SCOPEACT.java?rev=577112&r1=577111&r2=577112&view=diff
==============================================================================
--- ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/SCOPEACT.java (original)
+++ ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/SCOPEACT.java Tue Sep 18 16:55:20 2007
@@ -18,24 +18,207 @@
  */
 package org.apache.ode.bpel.runtime;
 
+import java.io.Serializable;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Set;
+
 import org.apache.ode.bpel.o.OScope;
+import org.apache.ode.bpel.o.OScope.Variable;
+import org.apache.ode.bpel.runtime.channels.FaultData;
+import org.apache.ode.bpel.runtime.channels.ParentScopeChannel;
+import org.apache.ode.bpel.runtime.channels.ParentScopeChannelListener;
+import org.apache.ode.bpel.runtime.channels.ReadWriteLockChannel;
+import org.apache.ode.jacob.SynchChannel;
+import org.apache.ode.jacob.SynchChannelListener;
+import org.w3c.dom.Element;
 
 /**
- * A scope activity. The scope activity creates a new scope frame and proceeeds
- * using the {@link SCOPE} template. 
+ * A scope activity. The scope activity creates a new scope frame and proceeeds using the {@link SCOPE} template.
  */
 public class SCOPEACT extends ACTIVITY {
-  private static final long serialVersionUID = -4593029783757994939L;
+    private static final long serialVersionUID = -4593029783757994939L;
+
+    public SCOPEACT(ActivityInfo self, ScopeFrame scopeFrame, LinkFrame linkFrame) {
+        super(self, scopeFrame, linkFrame);
+    }
+
+    public void run() {
+
+        if (((OScope) _self.o).isolatedScope) {
+            instance(new ISOLATEDGUARD(createLockList(), newChannel(SynchChannel.class)));
+
+        } else {
+            ScopeFrame newFrame = new ScopeFrame((OScope) _self.o, getBpelRuntimeContext().createScopeInstance(
+                    _scopeFrame.scopeInstanceId, (OScope) _self.o), _scopeFrame, null);
+
+            instance(new SCOPE(_self, newFrame, _linkFrame));
+        }
+
+    }
+
+    /**
+     * Create an ordered list of required locks that need to be acquired before the activity can execute. The list is ordered to
+     * prevent dead-lock. The method of ordering is not especially important, so long as the same method is always used.
+     * 
+     * @return
+     */
+    private List<IsolationLock> createLockList() {
+        LinkedList<IsolationLock> requiredLocks = new LinkedList<IsolationLock>();
+        OScope o = ((OScope) _self.o);
+
+        Set<Variable> vrs = new HashSet<Variable>(o.variableRd);
+        vrs.addAll(o.variableWr);
+
+        for (Variable v : vrs)
+            requiredLocks.add(new IsolationLock(v, o.variableWr.contains(v), _scopeFrame.globals._varLocks.get(v)));
+
+        // Very important, we must sort the locks to prevent deadlocks.
+        Collections.sort(requiredLocks);
+
+        return requiredLocks;
+    }
+
+    private class ISOLATEDGUARD extends BpelJacobRunnable {
+
+        private static final long serialVersionUID = -5017579415744600900L;
+        
+        final List<IsolationLock> _locksNeeded;
+        final LinkedList<IsolationLock> _locksAcquired = new LinkedList<IsolationLock>();
+        final SynchChannel _synchChannel;
+
+        public ISOLATEDGUARD(List<IsolationLock> locks, SynchChannel synchChannel) {
+            _locksNeeded = locks;
+            _synchChannel = synchChannel;
+        }
+
+        @Override
+        public void run() {
+            if (_locksNeeded.isEmpty()) {
+                // acquired all locks.
+                
+                ScopeFrame newFrame = new ScopeFrame((OScope) _self.o, getBpelRuntimeContext().createScopeInstance(
+                        _scopeFrame.scopeInstanceId, (OScope) _self.o), _scopeFrame, null);
+                // need to make sure to release the locks after the scope completes, to do this, intercept messages
+                // on the parent scope channel.
+                if (!_locksAcquired.isEmpty()) {
+                    final ParentScopeChannel parent = _self.parent;
+                    _self.parent = newChannel(ParentScopeChannel.class);
+                    instance(new UNLOCKER(_self.parent, parent,_synchChannel, _locksAcquired));
+                }
+                
+                instance(new SCOPE(_self, newFrame, _linkFrame));
+                return;
+            } else {
+                // try to acquire the locks in sequence (IMPORTANT) not all at once.
+                IsolationLock il = _locksNeeded.get(0);
+                if (il.writeLock)
+                    il.lockChannel.writeLock(_synchChannel);
+                else
+                    il.lockChannel.readLock(_synchChannel);
+                
+                object(new SynchChannelListener(_synchChannel) {
+                        private static final long serialVersionUID = 2857261074409098274L;
+
+                        public void ret() {
+                            _locksAcquired.add(_locksNeeded.remove(0));
+                            instance(ISOLATEDGUARD.this);
+                        }
+                });
+            
+            }    
+        }
+        
+    }
+
+    
+    private static class UNLOCKER extends BpelJacobRunnable {
+
+        private static final long serialVersionUID = -476393080609348172L;
+        
+        private final ParentScopeChannel _self;
+        private final ParentScopeChannel _parent;
+        private final SynchChannel _synchChannel;
+        private final LinkedList<IsolationLock> _locks;
+
+        public UNLOCKER(ParentScopeChannel self, ParentScopeChannel parent, SynchChannel synchChannel, LinkedList<IsolationLock> locksAcquired) {
+            _self = self;
+            _parent = parent;
+            _synchChannel = synchChannel;
+            _locks = locksAcquired;
+        }
+
+        @Override
+        public void run() {
+
+            object(new ParentScopeChannelListener(_self) {
+
+                public void cancelled() {
+                    _parent.cancelled();
+                    unlockAll();
+                    // no more listening.
+                }
+
+                public void compensate(OScope scope, SynchChannel ret) {
+                    _parent.compensate(scope, ret);
+                    // keep listening
+                    instance(UNLOCKER.this);
+                }
+
+                public void completed(FaultData faultData, Set<CompensationHandler> compensations) {
+                    _parent.completed(faultData, compensations);
+                    unlockAll();
+                    // no more listening
+                    
+                }
+
+                public void failure(String reason, Element data) {
+                    _parent.failure(reason, data);
+                    unlockAll();
+                    // no more listening
+                }
+                
+            });            
+        }
+
+        /**
+         * Unlock all the acquired locks. 
+         *
+         */
+        private void unlockAll() {
+            for (IsolationLock il : _locks) 
+                il.lockChannel.unlock(_synchChannel);
+            _locks.clear();
+        }
+        
+    }
+
+    /**
+     * Representation of a lock needed by an isolated scope.
+     * 
+     * @author Maciej Szefler <mszefler at gmail dot com>
+     * 
+     */
+    private static class IsolationLock implements Comparable<IsolationLock>,Serializable {
+        private static final long serialVersionUID = 4214864393241172705L;
+
+        OScope.Variable guardedObject;
+
+        boolean writeLock;
+
+        ReadWriteLockChannel lockChannel;
+
+        public IsolationLock(OScope.Variable go, boolean writeLock, ReadWriteLockChannel channel) {
+            this.guardedObject = go;
+            this.writeLock = writeLock;
+            this.lockChannel = channel;
+        }
+
+        public int compareTo(IsolationLock o) {
+            return guardedObject.getId() - o.guardedObject.getId();
+        }
 
-  public SCOPEACT(ActivityInfo self, ScopeFrame scopeFrame, LinkFrame linkFrame) {
-    super(self, scopeFrame, linkFrame);
-  }
-
-  public void run() {
-    ScopeFrame newFrame = new ScopeFrame(
-            (OScope) _self.o,getBpelRuntimeContext().createScopeInstance(_scopeFrame.scopeInstanceId,(OScope) _self.o),
-            _scopeFrame,
-            null);
-    instance(new SCOPE(_self,newFrame, _linkFrame));
-  }
+    }
 }

Modified: ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/ScopeFrame.java
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/ScopeFrame.java?rev=577112&r1=577111&r2=577112&view=diff
==============================================================================
--- ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/ScopeFrame.java (original)
+++ ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/runtime/ScopeFrame.java Tue Sep 18 16:55:20 2007
@@ -47,6 +47,8 @@
 
     /** The fault context for this scope. */
     private FaultData _faultData;
+    
+    final InstanceGlobals globals;
 
     /** Constructor used to create "fault" scopes. */
     ScopeFrame( OScope scopeDef,
@@ -54,19 +56,27 @@
                 ScopeFrame parent,
                 Set<CompensationHandler> visibleCompensationHandlers,
                 FaultData fault) {
-        this(scopeDef,scopeInstanceId,parent,visibleCompensationHandlers);
+        this(scopeDef,scopeInstanceId,parent,visibleCompensationHandlers, parent.globals);
         _faultData = fault;
 
     }
-
+    public ScopeFrame( OScope scopeDef,
+            Long scopeInstanceId,
+            ScopeFrame parent,
+            Set<CompensationHandler> visibleCompensationHandlers) {
+        this(scopeDef,scopeInstanceId,parent,visibleCompensationHandlers,parent.globals);
+    }
+    
     public ScopeFrame( OScope scopeDef,
                        Long scopeInstanceId,
                        ScopeFrame parent,
-                       Set<CompensationHandler> visibleCompensationHandlers) {
+                       Set<CompensationHandler> visibleCompensationHandlers,
+                       InstanceGlobals globals) {
         this.oscope = scopeDef;
         this.scopeInstanceId = scopeInstanceId;
         this.parent = parent;
         this.availableCompensations = visibleCompensationHandlers;
+        this.globals = globals;
     }
 
 

Modified: ode/trunk/bpel-runtime/src/test/java/org/apache/ode/bpel/runtime/MockBpelServer.java
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-runtime/src/test/java/org/apache/ode/bpel/runtime/MockBpelServer.java?rev=577112&r1=577111&r2=577112&view=diff
==============================================================================
--- ode/trunk/bpel-runtime/src/test/java/org/apache/ode/bpel/runtime/MockBpelServer.java (original)
+++ ode/trunk/bpel-runtime/src/test/java/org/apache/ode/bpel/runtime/MockBpelServer.java Tue Sep 18 16:55:20 2007
@@ -20,6 +20,7 @@
 
 import java.io.File;
 import java.util.Collection;
+import java.util.Collections;
 import java.util.HashMap;
 import java.util.Properties;
 import java.util.Set;
@@ -217,8 +218,7 @@
             }
 
             public Set<InvocationStyle> getSupportedInvocationStyle(PartnerRoleChannel prc, EndpointReference partnerEpr) {
-                // TODO Auto-generated method stub
-                return null;
+                return Collections.singleton(InvocationStyle.UNRELIABLE);
             }
 
             public void invokePartnerUnreliable(PartnerRoleMessageExchange mex) throws ContextException {

Modified: ode/trunk/jacob/src/main/java/org/apache/ode/jacob/JacobObject.java
URL: http://svn.apache.org/viewvc/ode/trunk/jacob/src/main/java/org/apache/ode/jacob/JacobObject.java?rev=577112&r1=577111&r2=577112&view=diff
==============================================================================
--- ode/trunk/jacob/src/main/java/org/apache/ode/jacob/JacobObject.java (original)
+++ ode/trunk/jacob/src/main/java/org/apache/ode/jacob/JacobObject.java Tue Sep 18 16:55:20 2007
@@ -81,25 +81,25 @@
      * @param methodList method list for the communication reduction
      * @see JacobThread#object
      */
-    protected static <T extends Channel> T object(ChannelListener<T> methodList) {
+    protected static <T extends Channel,  L extends ChannelListener<T>> T object(L methodList) {
         JacobVPU.activeJacobThread().object(false, methodList);
         return methodList.getChannel();
     }
 
-    protected static void object(boolean replication, ChannelListener methodList) {
+    protected static <T extends Channel,  L extends ChannelListener<T>> void object(boolean replication, L methodList) {
         JacobVPU.activeJacobThread().object(replication, methodList);
     }
 
-    protected static void object(boolean replication, ChannelListener[] methodLists) {
+    protected static  <T extends Channel, L extends ChannelListener<T>> void object(boolean replication, L[] methodLists) {
         JacobVPU.activeJacobThread().object(replication, methodLists);
     }
 
-    protected static void object(boolean replication, Set<ChannelListener> methodLists) {
+    protected static <T extends Channel, L extends ChannelListener<T>> void object(boolean replication, Set<L> methodLists) {
         JacobVPU.activeJacobThread().object(replication,
                 methodLists.toArray(new ChannelListener[methodLists.size()]));
     }
 
-    protected static <T extends Channel> T replication(ChannelListener<T> methodList) {
+    protected static <T extends Channel, L extends ChannelListener<T>> T replication(L methodList) {
         JacobVPU.activeJacobThread().object(true, methodList);
         return methodList.getChannel();
     }