Data conflict when read file
I have a flow: Angualr http service call API(spring boot) read file and save data in DB.
Peoblem: When httpService call api with loop, It is almost at the same time -> api read file have been conflict data of files(for one client).
Example: When api is processing file pdf A, request read file pdf B have sent, and data save in DB will conflict between file A and B. Condition check data will be conflict.
Read file pdf A: if (nonExist) -> save DB -> reset nonExist variable. But when call api with file pdf B (same time) -> nonExist variable will be not reseted -> the next time value of nonExist will be wrong.
My code below:
Controller:
@ApiOperation(value = "Import file property ware")
@ApiImplicitParams(value = { @ApiImplicitParam(name = "File", dataTypeClass = MultipartFile.class) })
@PostMapping(value = URL.IMPORT_FILE, consumes = CommonConstants.CONSUME_MULTI_PART)
@ResponseBody
public ResponseEntity<Void> doUploadExchangeRateFile(
@RequestParam(value = "file") MultipartFile file
, @RequestParam(value = "customerId") Long customerId
, @RequestParam(value = "importType") Integer importType,
HttpServletRequest request) {
propertyWareService.importFilePdf(customerId, file, request);
return new ResponseEntity<>(HttpStatus.OK);
}
and service:
public StateReadPdfImport getListProperties(MultipartFile file, HttpServletRequest request, Long optCustomerId) {
PDFTextStripper stripper;
Boolean headerTrans = false;
Boolean endTransaction = false;
Boolean endBillDue = false;
Boolean isBillDue = false;
Boolean chkBeginning = false;
double previousBalance;
StringBuilder strTrans = new StringBuilder("");
StringBuilder strBillDue = new StringBuilder("");
int rowTrans = 0;
int rowBillsDue = 0;
try (PDDocument document = PDDocument.load( new File(dirFile) )) {
int pageNumber = document.getNumberOfPages();
PmrPropertyRequestPdf pmrPropertyRequestPdf = new PmrPropertyRequestPdf();
pmrPropertyRequestPdf.setTransactionDetailBeginningBalance(null);
for (int i=1; i < pageNumber + 1; i++) {
stripper = new PropertyPdfReader();
stripper.setSortByPosition( true );
stripper.setStartPage(i);
stripper.setEndPage(i);
lines.clear();
Writer dummy = new OutputStreamWriter(new ByteArrayOutputStream());
stripper.writeText(document, dummy);
previousBalance = 0D;
int zIndex = 1;
for (int j = 0; j < lines.size(); j+=zIndex) {
WordAndCoordinates wordAndCoordinates = lines.get(j);
String line = wordAndCoordinates.getWord();
if (!isBillDue) {
if (line.equals("Property Cash Summary")
&& wordAndCoordinates.getTextPosition().get(0).getFontSizeInPt() == 12.0) {
pmrPropertyRequestPdf.setNameAndAddress(lines.get(j-1).getWord().trim());
} else if (checkHeader(lines, j)) {
this.setHeaderTransDetail(lines, j, lstHeaderTransDetail);
headerTrans = true;
zIndex = 8;
} else if (headerTrans) {
if (line.contains(TransactionConstants.BEGINNING_CASH_BALANCE) && !chkBeginning) {
//reset chkBeginning = true, but in the next acces it is false
chkBeginning = true;
pmrPropertyRequestPdf.setTransactionDetailBeginningBalance(previousBalance);
}
} else if (line.equals(TransactionConstants.BILLS_DUE) && checkHeaderBillDue(lines, j + 1)) {
this.setHeaderTransBill(lines, j+1, lstHeaderTransBill);
isBillDue = true;
zIndex = 5;
}
} else {
zIndex = 1;
}
}
if (StringUtils.isBlank(pmrPropertyRequestPdf.getNameAndAddress())) {
continue;
}
if (endTransaction) {
this.setTransactionDetail(strTrans, pmrPropertyRequestPdf, transactionTypeMap, previousBalance, lstHeaderTransDetail, positionMap);
//reset chkBeginning= false after save data of a page of PDF file to DB
chkBeginning = false;
}
lines.clear();
}
} catch (Exception ex) {
Map<String, Object> error = OhaCommonUtil.setFileException(file);
throw new OhaApplicationException(error, HttpStatus.BAD_REQUEST, ex.getMessage());
}
return ...;
}
I tried google but I'm stuck and can not find anything solution!
May you help me ?
Thank you!
java
|
show 3 more comments
I have a flow: Angualr http service call API(spring boot) read file and save data in DB.
Peoblem: When httpService call api with loop, It is almost at the same time -> api read file have been conflict data of files(for one client).
Example: When api is processing file pdf A, request read file pdf B have sent, and data save in DB will conflict between file A and B. Condition check data will be conflict.
Read file pdf A: if (nonExist) -> save DB -> reset nonExist variable. But when call api with file pdf B (same time) -> nonExist variable will be not reseted -> the next time value of nonExist will be wrong.
My code below:
Controller:
@ApiOperation(value = "Import file property ware")
@ApiImplicitParams(value = { @ApiImplicitParam(name = "File", dataTypeClass = MultipartFile.class) })
@PostMapping(value = URL.IMPORT_FILE, consumes = CommonConstants.CONSUME_MULTI_PART)
@ResponseBody
public ResponseEntity<Void> doUploadExchangeRateFile(
@RequestParam(value = "file") MultipartFile file
, @RequestParam(value = "customerId") Long customerId
, @RequestParam(value = "importType") Integer importType,
HttpServletRequest request) {
propertyWareService.importFilePdf(customerId, file, request);
return new ResponseEntity<>(HttpStatus.OK);
}
and service:
public StateReadPdfImport getListProperties(MultipartFile file, HttpServletRequest request, Long optCustomerId) {
PDFTextStripper stripper;
Boolean headerTrans = false;
Boolean endTransaction = false;
Boolean endBillDue = false;
Boolean isBillDue = false;
Boolean chkBeginning = false;
double previousBalance;
StringBuilder strTrans = new StringBuilder("");
StringBuilder strBillDue = new StringBuilder("");
int rowTrans = 0;
int rowBillsDue = 0;
try (PDDocument document = PDDocument.load( new File(dirFile) )) {
int pageNumber = document.getNumberOfPages();
PmrPropertyRequestPdf pmrPropertyRequestPdf = new PmrPropertyRequestPdf();
pmrPropertyRequestPdf.setTransactionDetailBeginningBalance(null);
for (int i=1; i < pageNumber + 1; i++) {
stripper = new PropertyPdfReader();
stripper.setSortByPosition( true );
stripper.setStartPage(i);
stripper.setEndPage(i);
lines.clear();
Writer dummy = new OutputStreamWriter(new ByteArrayOutputStream());
stripper.writeText(document, dummy);
previousBalance = 0D;
int zIndex = 1;
for (int j = 0; j < lines.size(); j+=zIndex) {
WordAndCoordinates wordAndCoordinates = lines.get(j);
String line = wordAndCoordinates.getWord();
if (!isBillDue) {
if (line.equals("Property Cash Summary")
&& wordAndCoordinates.getTextPosition().get(0).getFontSizeInPt() == 12.0) {
pmrPropertyRequestPdf.setNameAndAddress(lines.get(j-1).getWord().trim());
} else if (checkHeader(lines, j)) {
this.setHeaderTransDetail(lines, j, lstHeaderTransDetail);
headerTrans = true;
zIndex = 8;
} else if (headerTrans) {
if (line.contains(TransactionConstants.BEGINNING_CASH_BALANCE) && !chkBeginning) {
//reset chkBeginning = true, but in the next acces it is false
chkBeginning = true;
pmrPropertyRequestPdf.setTransactionDetailBeginningBalance(previousBalance);
}
} else if (line.equals(TransactionConstants.BILLS_DUE) && checkHeaderBillDue(lines, j + 1)) {
this.setHeaderTransBill(lines, j+1, lstHeaderTransBill);
isBillDue = true;
zIndex = 5;
}
} else {
zIndex = 1;
}
}
if (StringUtils.isBlank(pmrPropertyRequestPdf.getNameAndAddress())) {
continue;
}
if (endTransaction) {
this.setTransactionDetail(strTrans, pmrPropertyRequestPdf, transactionTypeMap, previousBalance, lstHeaderTransDetail, positionMap);
//reset chkBeginning= false after save data of a page of PDF file to DB
chkBeginning = false;
}
lines.clear();
}
} catch (Exception ex) {
Map<String, Object> error = OhaCommonUtil.setFileException(file);
throw new OhaApplicationException(error, HttpStatus.BAD_REQUEST, ex.getMessage());
}
return ...;
}
I tried google but I'm stuck and can not find anything solution!
May you help me ?
Thank you!
java
1
What do you mean by "data conflict"? Please be more specific. What do the files mean. What is saved in DB and for what use? What is the trouble in saving data from two different files - how do they conflict?
– RealSkeptic
Jan 2 at 9:31
It is hard to understand the exact problem, maybe because of language. Ideally you should have no fields, just local variables, so no mixups can happen with parallel access.
– Joop Eggen
Jan 2 at 9:34
Hi @RealSkeptic ,Joop Eggen.. I have updated question. Thanks for your time!
– Nhe Thoi
Jan 2 at 9:52
Still 0 line of code, and still 0 explanation of what the code is supposed to do and what it does instead. We don't know anything about your requirements and your code if you don't post them.
– JB Nizet
Jan 2 at 9:53
Ah, so you have a common variable somewhere. That's not good. Please include a Minimal, Complete, and Verifiable example in your question.
– RealSkeptic
Jan 2 at 9:53
|
show 3 more comments
I have a flow: Angualr http service call API(spring boot) read file and save data in DB.
Peoblem: When httpService call api with loop, It is almost at the same time -> api read file have been conflict data of files(for one client).
Example: When api is processing file pdf A, request read file pdf B have sent, and data save in DB will conflict between file A and B. Condition check data will be conflict.
Read file pdf A: if (nonExist) -> save DB -> reset nonExist variable. But when call api with file pdf B (same time) -> nonExist variable will be not reseted -> the next time value of nonExist will be wrong.
My code below:
Controller:
@ApiOperation(value = "Import file property ware")
@ApiImplicitParams(value = { @ApiImplicitParam(name = "File", dataTypeClass = MultipartFile.class) })
@PostMapping(value = URL.IMPORT_FILE, consumes = CommonConstants.CONSUME_MULTI_PART)
@ResponseBody
public ResponseEntity<Void> doUploadExchangeRateFile(
@RequestParam(value = "file") MultipartFile file
, @RequestParam(value = "customerId") Long customerId
, @RequestParam(value = "importType") Integer importType,
HttpServletRequest request) {
propertyWareService.importFilePdf(customerId, file, request);
return new ResponseEntity<>(HttpStatus.OK);
}
and service:
public StateReadPdfImport getListProperties(MultipartFile file, HttpServletRequest request, Long optCustomerId) {
PDFTextStripper stripper;
Boolean headerTrans = false;
Boolean endTransaction = false;
Boolean endBillDue = false;
Boolean isBillDue = false;
Boolean chkBeginning = false;
double previousBalance;
StringBuilder strTrans = new StringBuilder("");
StringBuilder strBillDue = new StringBuilder("");
int rowTrans = 0;
int rowBillsDue = 0;
try (PDDocument document = PDDocument.load( new File(dirFile) )) {
int pageNumber = document.getNumberOfPages();
PmrPropertyRequestPdf pmrPropertyRequestPdf = new PmrPropertyRequestPdf();
pmrPropertyRequestPdf.setTransactionDetailBeginningBalance(null);
for (int i=1; i < pageNumber + 1; i++) {
stripper = new PropertyPdfReader();
stripper.setSortByPosition( true );
stripper.setStartPage(i);
stripper.setEndPage(i);
lines.clear();
Writer dummy = new OutputStreamWriter(new ByteArrayOutputStream());
stripper.writeText(document, dummy);
previousBalance = 0D;
int zIndex = 1;
for (int j = 0; j < lines.size(); j+=zIndex) {
WordAndCoordinates wordAndCoordinates = lines.get(j);
String line = wordAndCoordinates.getWord();
if (!isBillDue) {
if (line.equals("Property Cash Summary")
&& wordAndCoordinates.getTextPosition().get(0).getFontSizeInPt() == 12.0) {
pmrPropertyRequestPdf.setNameAndAddress(lines.get(j-1).getWord().trim());
} else if (checkHeader(lines, j)) {
this.setHeaderTransDetail(lines, j, lstHeaderTransDetail);
headerTrans = true;
zIndex = 8;
} else if (headerTrans) {
if (line.contains(TransactionConstants.BEGINNING_CASH_BALANCE) && !chkBeginning) {
//reset chkBeginning = true, but in the next acces it is false
chkBeginning = true;
pmrPropertyRequestPdf.setTransactionDetailBeginningBalance(previousBalance);
}
} else if (line.equals(TransactionConstants.BILLS_DUE) && checkHeaderBillDue(lines, j + 1)) {
this.setHeaderTransBill(lines, j+1, lstHeaderTransBill);
isBillDue = true;
zIndex = 5;
}
} else {
zIndex = 1;
}
}
if (StringUtils.isBlank(pmrPropertyRequestPdf.getNameAndAddress())) {
continue;
}
if (endTransaction) {
this.setTransactionDetail(strTrans, pmrPropertyRequestPdf, transactionTypeMap, previousBalance, lstHeaderTransDetail, positionMap);
//reset chkBeginning= false after save data of a page of PDF file to DB
chkBeginning = false;
}
lines.clear();
}
} catch (Exception ex) {
Map<String, Object> error = OhaCommonUtil.setFileException(file);
throw new OhaApplicationException(error, HttpStatus.BAD_REQUEST, ex.getMessage());
}
return ...;
}
I tried google but I'm stuck and can not find anything solution!
May you help me ?
Thank you!
java
I have a flow: Angualr http service call API(spring boot) read file and save data in DB.
Peoblem: When httpService call api with loop, It is almost at the same time -> api read file have been conflict data of files(for one client).
Example: When api is processing file pdf A, request read file pdf B have sent, and data save in DB will conflict between file A and B. Condition check data will be conflict.
Read file pdf A: if (nonExist) -> save DB -> reset nonExist variable. But when call api with file pdf B (same time) -> nonExist variable will be not reseted -> the next time value of nonExist will be wrong.
My code below:
Controller:
@ApiOperation(value = "Import file property ware")
@ApiImplicitParams(value = { @ApiImplicitParam(name = "File", dataTypeClass = MultipartFile.class) })
@PostMapping(value = URL.IMPORT_FILE, consumes = CommonConstants.CONSUME_MULTI_PART)
@ResponseBody
public ResponseEntity<Void> doUploadExchangeRateFile(
@RequestParam(value = "file") MultipartFile file
, @RequestParam(value = "customerId") Long customerId
, @RequestParam(value = "importType") Integer importType,
HttpServletRequest request) {
propertyWareService.importFilePdf(customerId, file, request);
return new ResponseEntity<>(HttpStatus.OK);
}
and service:
public StateReadPdfImport getListProperties(MultipartFile file, HttpServletRequest request, Long optCustomerId) {
PDFTextStripper stripper;
Boolean headerTrans = false;
Boolean endTransaction = false;
Boolean endBillDue = false;
Boolean isBillDue = false;
Boolean chkBeginning = false;
double previousBalance;
StringBuilder strTrans = new StringBuilder("");
StringBuilder strBillDue = new StringBuilder("");
int rowTrans = 0;
int rowBillsDue = 0;
try (PDDocument document = PDDocument.load( new File(dirFile) )) {
int pageNumber = document.getNumberOfPages();
PmrPropertyRequestPdf pmrPropertyRequestPdf = new PmrPropertyRequestPdf();
pmrPropertyRequestPdf.setTransactionDetailBeginningBalance(null);
for (int i=1; i < pageNumber + 1; i++) {
stripper = new PropertyPdfReader();
stripper.setSortByPosition( true );
stripper.setStartPage(i);
stripper.setEndPage(i);
lines.clear();
Writer dummy = new OutputStreamWriter(new ByteArrayOutputStream());
stripper.writeText(document, dummy);
previousBalance = 0D;
int zIndex = 1;
for (int j = 0; j < lines.size(); j+=zIndex) {
WordAndCoordinates wordAndCoordinates = lines.get(j);
String line = wordAndCoordinates.getWord();
if (!isBillDue) {
if (line.equals("Property Cash Summary")
&& wordAndCoordinates.getTextPosition().get(0).getFontSizeInPt() == 12.0) {
pmrPropertyRequestPdf.setNameAndAddress(lines.get(j-1).getWord().trim());
} else if (checkHeader(lines, j)) {
this.setHeaderTransDetail(lines, j, lstHeaderTransDetail);
headerTrans = true;
zIndex = 8;
} else if (headerTrans) {
if (line.contains(TransactionConstants.BEGINNING_CASH_BALANCE) && !chkBeginning) {
//reset chkBeginning = true, but in the next acces it is false
chkBeginning = true;
pmrPropertyRequestPdf.setTransactionDetailBeginningBalance(previousBalance);
}
} else if (line.equals(TransactionConstants.BILLS_DUE) && checkHeaderBillDue(lines, j + 1)) {
this.setHeaderTransBill(lines, j+1, lstHeaderTransBill);
isBillDue = true;
zIndex = 5;
}
} else {
zIndex = 1;
}
}
if (StringUtils.isBlank(pmrPropertyRequestPdf.getNameAndAddress())) {
continue;
}
if (endTransaction) {
this.setTransactionDetail(strTrans, pmrPropertyRequestPdf, transactionTypeMap, previousBalance, lstHeaderTransDetail, positionMap);
//reset chkBeginning= false after save data of a page of PDF file to DB
chkBeginning = false;
}
lines.clear();
}
} catch (Exception ex) {
Map<String, Object> error = OhaCommonUtil.setFileException(file);
throw new OhaApplicationException(error, HttpStatus.BAD_REQUEST, ex.getMessage());
}
return ...;
}
I tried google but I'm stuck and can not find anything solution!
May you help me ?
Thank you!
java
java
edited Jan 2 at 10:13
Nhe Thoi
asked Jan 2 at 9:26
Nhe ThoiNhe Thoi
12
12
1
What do you mean by "data conflict"? Please be more specific. What do the files mean. What is saved in DB and for what use? What is the trouble in saving data from two different files - how do they conflict?
– RealSkeptic
Jan 2 at 9:31
It is hard to understand the exact problem, maybe because of language. Ideally you should have no fields, just local variables, so no mixups can happen with parallel access.
– Joop Eggen
Jan 2 at 9:34
Hi @RealSkeptic ,Joop Eggen.. I have updated question. Thanks for your time!
– Nhe Thoi
Jan 2 at 9:52
Still 0 line of code, and still 0 explanation of what the code is supposed to do and what it does instead. We don't know anything about your requirements and your code if you don't post them.
– JB Nizet
Jan 2 at 9:53
Ah, so you have a common variable somewhere. That's not good. Please include a Minimal, Complete, and Verifiable example in your question.
– RealSkeptic
Jan 2 at 9:53
|
show 3 more comments
1
What do you mean by "data conflict"? Please be more specific. What do the files mean. What is saved in DB and for what use? What is the trouble in saving data from two different files - how do they conflict?
– RealSkeptic
Jan 2 at 9:31
It is hard to understand the exact problem, maybe because of language. Ideally you should have no fields, just local variables, so no mixups can happen with parallel access.
– Joop Eggen
Jan 2 at 9:34
Hi @RealSkeptic ,Joop Eggen.. I have updated question. Thanks for your time!
– Nhe Thoi
Jan 2 at 9:52
Still 0 line of code, and still 0 explanation of what the code is supposed to do and what it does instead. We don't know anything about your requirements and your code if you don't post them.
– JB Nizet
Jan 2 at 9:53
Ah, so you have a common variable somewhere. That's not good. Please include a Minimal, Complete, and Verifiable example in your question.
– RealSkeptic
Jan 2 at 9:53
1
1
What do you mean by "data conflict"? Please be more specific. What do the files mean. What is saved in DB and for what use? What is the trouble in saving data from two different files - how do they conflict?
– RealSkeptic
Jan 2 at 9:31
What do you mean by "data conflict"? Please be more specific. What do the files mean. What is saved in DB and for what use? What is the trouble in saving data from two different files - how do they conflict?
– RealSkeptic
Jan 2 at 9:31
It is hard to understand the exact problem, maybe because of language. Ideally you should have no fields, just local variables, so no mixups can happen with parallel access.
– Joop Eggen
Jan 2 at 9:34
It is hard to understand the exact problem, maybe because of language. Ideally you should have no fields, just local variables, so no mixups can happen with parallel access.
– Joop Eggen
Jan 2 at 9:34
Hi @RealSkeptic ,Joop Eggen.. I have updated question. Thanks for your time!
– Nhe Thoi
Jan 2 at 9:52
Hi @RealSkeptic ,Joop Eggen.. I have updated question. Thanks for your time!
– Nhe Thoi
Jan 2 at 9:52
Still 0 line of code, and still 0 explanation of what the code is supposed to do and what it does instead. We don't know anything about your requirements and your code if you don't post them.
– JB Nizet
Jan 2 at 9:53
Still 0 line of code, and still 0 explanation of what the code is supposed to do and what it does instead. We don't know anything about your requirements and your code if you don't post them.
– JB Nizet
Jan 2 at 9:53
Ah, so you have a common variable somewhere. That's not good. Please include a Minimal, Complete, and Verifiable example in your question.
– RealSkeptic
Jan 2 at 9:53
Ah, so you have a common variable somewhere. That's not good. Please include a Minimal, Complete, and Verifiable example in your question.
– RealSkeptic
Jan 2 at 9:53
|
show 3 more comments
0
active
oldest
votes
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54003903%2fdata-conflict-when-read-file%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54003903%2fdata-conflict-when-read-file%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
1
What do you mean by "data conflict"? Please be more specific. What do the files mean. What is saved in DB and for what use? What is the trouble in saving data from two different files - how do they conflict?
– RealSkeptic
Jan 2 at 9:31
It is hard to understand the exact problem, maybe because of language. Ideally you should have no fields, just local variables, so no mixups can happen with parallel access.
– Joop Eggen
Jan 2 at 9:34
Hi @RealSkeptic ,Joop Eggen.. I have updated question. Thanks for your time!
– Nhe Thoi
Jan 2 at 9:52
Still 0 line of code, and still 0 explanation of what the code is supposed to do and what it does instead. We don't know anything about your requirements and your code if you don't post them.
– JB Nizet
Jan 2 at 9:53
Ah, so you have a common variable somewhere. That's not good. Please include a Minimal, Complete, and Verifiable example in your question.
– RealSkeptic
Jan 2 at 9:53