Compare commits

...

3 Commits

3 changed files with 33 additions and 5 deletions

View File

@@ -114,6 +114,15 @@ for (final String fieldString : referenceProperties) {
%>
globalMap.put("<%=cid %>_COMPONENT_RUNTIME_PROPERTIES", props_<%=cid %>);
<%
boolean isParallelize ="true".equalsIgnoreCase(ElementParameterParser.getValue(node, "__PARALLELIZE__"));
if (isParallelize) {
%>
final String buffersSizeKey_<%=cid%> = "buffersSizeKey_<%=cid%>_" + Thread.currentThread().getId();
<%
}
%>
org.talend.components.api.container.RuntimeContainer container_<%=cid%> = new org.talend.components.api.container.RuntimeContainer() {
public Object getComponentData(String componentId, String key) {
return globalMap.get(componentId + "_" + key);

View File

@@ -164,6 +164,18 @@ if(hasInput){
%>
org.apache.avro.generic.IndexedRecord data_<%=cid%> = incomingEnforcer_<%=cid%>.getCurrentRecord();
<%
boolean isParallelize ="true".equalsIgnoreCase(ElementParameterParser.getValue(node, "__PARALLELIZE__"));
if (isParallelize) {
String sourceComponentId = inputConn.getSource().getUniqueName();
if(sourceComponentId!=null && sourceComponentId.contains("tAsyncIn")) {
%>
globalMap.put(buffersSizeKey_<%=cid%>, buffersSize_<%=sourceComponentId%>);
<%
}
}
%>
writer_<%=cid%>.write(data_<%=cid%>);

View File

@@ -690,7 +690,7 @@ public class Component extends AbstractBasicComponent {
// These parameters is only work when TIS is loaded
// GLiu Added for Task http://jira.talendforge.org/browse/TESB-4279
if (PluginChecker.isTeamEdition() && !ComponentCategory.CATEGORY_4_CAMEL.getName().equals(getPaletteType())) {
boolean defaultParalelize = Boolean.FALSE;
boolean defaultParalelize = componentDefinition.isParallelize();
param = new ElementParameter(node);
param.setReadOnly(!defaultParalelize);
param.setName(EParameterName.PARALLELIZE.getName());
@@ -706,12 +706,14 @@ public class Component extends AbstractBasicComponent {
param = new ElementParameter(node);
param.setReadOnly(!defaultParalelize);
param.setName(EParameterName.PARALLELIZE_NUMBER.getName());
param.setValue(2);
param.setValue("2");
param.setDisplayName(EParameterName.PARALLELIZE_NUMBER.getDisplayName());
param.setFieldType(EParameterFieldType.TEXT);
param.setCategory(EComponentCategory.ADVANCED);
param.setNumRow(200);
param.setShowIf(EParameterName.PARALLELIZE.getName() + " == 'true'"); //$NON-NLS-1$
param.setNumRow(201);
//param.setShowIf(EParameterName.PARALLELIZE.getName() + " == 'true'"); //$NON-NLS-1$
//FIXME how to do the show if? now only show it always
param.setShow(true);
param.setDefaultValue(param.getValue());
listParam.add(param);
@@ -722,7 +724,7 @@ public class Component extends AbstractBasicComponent {
param.setDisplayName(EParameterName.PARALLELIZE_KEEP_EMPTY.getDisplayName());
param.setFieldType(EParameterFieldType.CHECK);
param.setCategory(EComponentCategory.ADVANCED);
param.setNumRow(200);
param.setNumRow(202);
param.setShow(false);
param.setDefaultValue(param.getValue());
listParam.add(param);
@@ -1120,6 +1122,11 @@ public class Component extends AbstractBasicComponent {
public boolean isDataAutoPropagated() {
return componentDefinition.isDataAutoPropagate();
}
@Override
public boolean canParallelize() {
return componentDefinition.isParallelize();
}
/*
* (non-Javadoc)