Package eu.curia.suivi2.dao.impl

Examples of eu.curia.suivi2.dao.impl.TopLinkDBOperations


      // Create Spring Context
      ClassPathXmlApplicationContext ctx = new ClassPathXmlApplicationContext(
          "applicationContext.xml");

      // Get bean
      final Reader reader = (Reader) ctx.getBean("readerThread");
      final Updater updater = (Updater) ctx.getBean("updaterThread");
      final UpdaterNoWait updaterNoWait = (UpdaterNoWait) ctx
          .getBean("updaterNoWaitThread");

      // Get thread
      Thread thReader = new Thread() {
        @SuppressWarnings("boxing")
        @Override
        public void run() {
          try {
            reader.action();
          } catch (DataAccessException dae) {
            // Check if there is a lock exception...
            if (dae instanceof TopLinkOptimisticLockingFailureException) {
              System.out
                  .printf(
View Full Code Here


      // Create Spring Context
      ClassPathXmlApplicationContext ctx = new ClassPathXmlApplicationContext(
          "applicationContext.xml");

      // Get bean
      final Reader reader = (Reader) ctx.getBean("readerThread");
      final ReaderLock readerLock = (ReaderLock) ctx
          .getBean("readerLockThread");
      final Updater updater = (Updater) ctx.getBean("updaterThread");

      // Get thread
      Thread thReader = new Thread() {
        @Override
        public void run() {
          reader.action();
        }
      };
      Thread thReaderLock = new Thread() {
        @Override
        public void run() {
View Full Code Here

      ClassPathXmlApplicationContext ctx = new ClassPathXmlApplicationContext(
          "applicationContext.xml");

      // Get bean
      final Reader reader = (Reader) ctx.getBean("readerThread");
      final ReaderLock readerLock = (ReaderLock) ctx
          .getBean("readerLockThread");
      final Updater updater = (Updater) ctx.getBean("updaterThread");

      // Get thread
      Thread thReader = new Thread() {
        @Override
        public void run() {
          reader.action();
        }
      };
      Thread thReaderLock = new Thread() {
        @Override
        public void run() {
          readerLock.action();
        }
      };
      Thread thUpdater = new Thread() {
        @Override
        public void run() {
View Full Code Here

      ClassPathXmlApplicationContext ctx = new ClassPathXmlApplicationContext(
          "applicationContext.xml");

      // Get bean
      final Reader reader = (Reader) ctx.getBean("readerThread");
      final Updater updater = (Updater) ctx.getBean("updaterThread");
      final UpdaterNoWait updaterNoWait = (UpdaterNoWait) ctx
          .getBean("updaterNoWaitThread");

      // Get thread
      Thread thReader = new Thread() {
        @SuppressWarnings("boxing")
        @Override
        public void run() {
          try {
            reader.action();
          } catch (DataAccessException dae) {
            // Check if there is a lock exception...
            if (dae instanceof TopLinkOptimisticLockingFailureException) {
              System.out
                  .printf(
                      "THREAD ID        : %s --> Version diff�rente !!!\n",
                      Thread.currentThread().getId());
            } else {
              System.out
                  .printf(
                      "THREAD ID        : %s --> Exception : %s !!!\n",
                      Thread.currentThread().getId(), dae
                          .getMessage());
            }
          } catch (Exception e) {
            e.printStackTrace();
          }
        }
      };

      Thread thUpdater = new Thread() {
        @SuppressWarnings("boxing")
        @Override
        public void run() {
          try {
            updater.action();
            System.out.printf(
                "THREAD ID        : %s --> Data updated !!!\n",
                Thread.currentThread().getId());
          } catch (DataAccessException dae) {
            // Check if there is a lock exception...
View Full Code Here

      // Get bean
      final Reader reader = (Reader) ctx.getBean("readerThread");
      final ReaderLock readerLock = (ReaderLock) ctx
          .getBean("readerLockThread");
      final Updater updater = (Updater) ctx.getBean("updaterThread");

      // Get thread
      Thread thReader = new Thread() {
        @Override
        public void run() {
          reader.action();
        }
      };
      Thread thReaderLock = new Thread() {
        @Override
        public void run() {
          readerLock.action();
        }
      };
      Thread thUpdater = new Thread() {
        @Override
        public void run() {
          updater.action();
        }
      };

      // Run test
      ScheduledExecutorService scheduler = Executors
View Full Code Here

          "applicationContext.xml");

      // Get bean
      final Reader reader = (Reader) ctx.getBean("readerThread");
      final Updater updater = (Updater) ctx.getBean("updaterThread");
      final UpdaterNoWait updaterNoWait = (UpdaterNoWait) ctx
          .getBean("updaterNoWaitThread");

      // Get thread
      Thread thReader = new Thread() {
        @SuppressWarnings("boxing")
        @Override
        public void run() {
          try {
            reader.action();
          } catch (DataAccessException dae) {
            // Check if there is a lock exception...
            if (dae instanceof TopLinkOptimisticLockingFailureException) {
              System.out
                  .printf(
                      "THREAD ID        : %s --> Version diff�rente !!!\n",
                      Thread.currentThread().getId());
            } else {
              System.out
                  .printf(
                      "THREAD ID        : %s --> Exception : %s !!!\n",
                      Thread.currentThread().getId(), dae
                          .getMessage());
            }
          } catch (Exception e) {
            e.printStackTrace();
          }
        }
      };

      Thread thUpdater = new Thread() {
        @SuppressWarnings("boxing")
        @Override
        public void run() {
          try {
            updater.action();
            System.out.printf(
                "THREAD ID        : %s --> Data updated !!!\n",
                Thread.currentThread().getId());
          } catch (DataAccessException dae) {
            // Check if there is a lock exception...
            if (dae instanceof TopLinkOptimisticLockingFailureException) {
              System.out
                  .printf(
                      "THREAD ID        : %s --> Version diff�rente !!!\n",
                      Thread.currentThread().getId());
            } else {
              System.out
                  .printf(
                      "THREAD ID        : %s --> Exception : %s !!!\n",
                      Thread.currentThread().getId(), dae
                          .getMessage());
            }
          } catch (InterruptedException ie) {
            ie.printStackTrace();
          } catch (Exception e) {
            e.printStackTrace();
          }
        }
      };
      Thread thUpdaterNoWait = new Thread() {
        @SuppressWarnings("boxing")
        @Override
        public void run() {

          try {
            updaterNoWait.action();
            System.out.printf(
                "THREAD ID        : %s --> Data updated !!!\n",
                Thread.currentThread().getId());
          } catch (DataAccessException dae) {
            // Check if there is a lock exception...
View Full Code Here

   * {@inheritDoc}
   */
  @SuppressWarnings("boxing")
  public Developer readDeveloperById(int id) throws DataAccessException {

    Developer d = new Developer();
    ReadObjectQuery read = new ReadObjectQuery(Developer.class);
    d.setIdDeveloper(id);
    read.setExampleObject(d);

    Object o = getTopLinkTemplate().executeQuery(read);
    return (o != null) ? (Developer) o : null;
  }
View Full Code Here

   */
  @SuppressWarnings("boxing")
  public Developer readAndLockDeveloperById(int id)
      throws DataAccessException {

    Developer d = new Developer();
    ReadObjectQuery read = new ReadObjectQuery(Developer.class);
    d.setIdDeveloper(id);
    read.setExampleObject(d);
    read.acquireLocksWithoutWaiting();

    Object o = getTopLinkTemplate().executeQuery(read);
    return (o != null) ? (Developer) o : null;
View Full Code Here

   * {@inheritDoc}
   */
  @SuppressWarnings("boxing")
  public Developer readDeveloperById(int id) throws DataAccessException {

    Developer d = new Developer();
    ReadObjectQuery read = new ReadObjectQuery(Developer.class);
    d.setIdDeveloper(id);
    read.setExampleObject(d);

    Object o = getTopLinkTemplate().executeQuery(read);
    return (o != null) ? (Developer) o : null;
  }
View Full Code Here

  public void action() throws DataAccessException {
    String name = "Reader:" + Thread.currentThread().getId() + ":";
    System.out.println("==============================");
    System.out.printf("THREAD ID        : %s\n", name);
    // Extract and display developer information
    Developer d = this.dbDao.readDeveloperById(DEVELOPER_ID);
    System.out.printf("DEV ID           : %s\n", d.getIdDeveloper());
    System.out.printf("DEV LOCK VERS ID : %s\n", d.getOptimisticLockId());
    System.out.printf("DEV NAME         : %s\n", d.getNameDeveloper());
    System.out.printf("DEV LEVEL        : %s\n", d.getIdDeveloperLevel()
        .getLabelLevel());
    System.out.printf("LEV LOCK VERS ID : %s\n", d.getIdDeveloperLevel()
        .getOptimisticLockId());
    System.out.println("==============================");
  }
View Full Code Here

TOP

Related Classes of eu.curia.suivi2.dao.impl.TopLinkDBOperations

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.