UOCL-285: payment screen hanging

This commit is contained in:
2025-01-06 12:28:44 +00:00
parent a038cc2282
commit ec9a49ade3
5 changed files with 25 additions and 5 deletions
@@ -41,6 +41,8 @@ import java.sql.SQLException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.UUID; import java.util.UUID;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
/** /**
@@ -276,6 +278,7 @@ public class CustomerCSVImport extends JPanel implements JPanelView {
* the UI responsiveness. * the UI responsiveness.
*/ */
private void setWorker() { private void setWorker() {
ExecutorService customExecutor = Executors.newCachedThreadPool();
progress = 0; progress = 0;
webPBar.setStringPainted(true); webPBar.setStringPainted(true);
@@ -304,7 +307,8 @@ public class CustomerCSVImport extends JPanel implements JPanelView {
} }
} }
}; };
pbWorker.execute(); // pbWorker.execute();
customExecutor.execute(pbWorker);
} }
/** /**
@@ -44,6 +44,8 @@ import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.UUID; import java.util.UUID;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
/** /**
@@ -292,6 +294,7 @@ public class JPanelCSVImport extends JPanel implements JPanelView {
* the UI responsiveness. * the UI responsiveness.
*/ */
private void setWorker() { private void setWorker() {
ExecutorService customExecutor = Executors.newCachedThreadPool();
progress = 0; progress = 0;
webPBar.setStringPainted(true); webPBar.setStringPainted(true);
@@ -320,7 +323,8 @@ public class JPanelCSVImport extends JPanel implements JPanelView {
} }
} }
}; };
pbWorker.execute(); //pbWorker.execute();
customExecutor.execute(pbWorker);
} }
/** /**
@@ -43,6 +43,8 @@ import java.sql.SQLException;
import java.util.List; import java.util.List;
import java.util.Properties; import java.util.Properties;
import java.util.UUID; import java.util.UUID;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
/** /**
@@ -511,6 +513,7 @@ public class StockQtyImport extends JPanel implements JPanelView {
* the UI responsiveness. * the UI responsiveness.
*/ */
private void setWorker() { private void setWorker() {
ExecutorService customExecutor = Executors.newCachedThreadPool();
progress = 0; progress = 0;
webPBar.setStringPainted(true); webPBar.setStringPainted(true);
@@ -539,7 +542,8 @@ public class StockQtyImport extends JPanel implements JPanelView {
} }
} }
}; };
pbWorker.execute(); //pbWorker.execute();
customExecutor.execute(pbWorker);
} }
/** /**
@@ -37,6 +37,8 @@ import lombok.extern.slf4j.Slf4j;
import java.util.List; import java.util.List;
import java.util.UUID; import java.util.UUID;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import javax.swing.*; import javax.swing.*;
/** /**
@@ -78,6 +80,7 @@ public class JTicketsBagShared extends JTicketsBag {
log.debug("Loading Sales screen! "+this.getClass()); log.debug("Loading Sales screen! "+this.getClass());
ExecutorService customExecutor = Executors.newCachedThreadPool();
SwingWorker<String, String> reloadLayaway = new SwingWorker<>() { SwingWorker<String, String> reloadLayaway = new SwingWorker<>() {
@Override @Override
protected String doInBackground() throws Exception { protected String doInBackground() throws Exception {
@@ -91,7 +94,8 @@ public class JTicketsBagShared extends JTicketsBag {
} }
}; };
reloadLayaway.execute(); //reloadLayaway.execute();
customExecutor.submit(reloadLayaway);
m_sCurrentTicket = null; m_sCurrentTicket = null;
@@ -43,6 +43,8 @@ import java.sql.*;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Properties; import java.util.Properties;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.regex.Matcher; import java.util.regex.Matcher;
/** /**
@@ -2721,6 +2723,7 @@ public final class Transfer extends JPanel implements JPanelView {
JOptionPane.YES_NO_OPTION, JOptionPane.YES_NO_OPTION,
JOptionPane.QUESTION_MESSAGE) == JOptionPane.YES_OPTION) { JOptionPane.QUESTION_MESSAGE) == JOptionPane.YES_OPTION) {
ExecutorService customExecutor = Executors.newCachedThreadPool();
SwingWorker<Void, Void> worker = new SwingWorker<Void, Void>() { SwingWorker<Void, Void> worker = new SwingWorker<Void, Void>() {
@Override @Override
@@ -2731,7 +2734,8 @@ public final class Transfer extends JPanel implements JPanelView {
} }
}; };
worker.execute(); //worker.execute();
customExecutor.execute(worker);
} }
System.gc(); System.gc();