Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class BankDatabaseSQL {
- private Connection connection;
- private ResultSet resultSet;
- private static final String URL = "jdbc:mysql://localhost/banktesting";
- private static final String USERNAME = "root";
- Account account;
- public final Object monitor = new Object();
- private PreparedStatement setBalance;
- private PreparedStatement getAccount;
- int numberOfRows;
- /** code omitted **/
- /**
- method in question
- */
- public synchronized boolean authenticatePrint(){
- try{
- MainForm mainForm = new MainForm();
- do{
- ExecutorService threadExecutor = Executors.newCachedThreadPool();
- mainForm.accNo = account.getAccountNumber();
- threadExecutor.execute(mainForm);
- wait();
- }while(mainForm.verified = false); // while the verified variable of the mainForm object is set to false,
- // the thread should keep waiting. The process has not gotten into this
- // if statement.
- if(mainForm.verified = true){
- System.out.println("time to notify");
- notify();
- }
- public class MainForm extends JFrame implements Runnable
- {
- public void run() {
- new MainForm();
- }
- public synchronized void onVerify() {
- VerificationForm form = new VerificationForm(this);
- form.setVisible(true);
- System.out.println("nTime to onVerify");
- if(form.verificationStatus = true){
- verified = true; // variable for the mainForm object to aid in notifying the thread
- System.out.println("nVerified = true has been set!");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement