Package helma.objectmodel.db

Examples of helma.objectmodel.db.Transactor


     * and start a new one
     *
     * @throws Exception thrown if commit fails
     */
    public void commit() throws Exception {
        Transactor tx = Transactor.getInstance();
        if (tx != null) {
            String tname = tx.getTransactionName();
            tx.commit();
            tx.begin(tname);
        }
    }
View Full Code Here


     * Rollback the current transaction and start a new one.
     *
     * @throws Exception thrown if rollback fails
     */
    public void rollback() throws Exception {
        Transactor tx = Transactor.getInstance();
        if (tx != null) {
            String tname = tx.getTransactionName();
            tx.abort();
            tx.begin(tname);
        }
    }
View Full Code Here

        } catch (Exception ignore) {
            System.out.println(ignore.toString());
        }

        long now = System.currentTimeMillis();
        Transactor tx = Transactor.getInstance(app.getNodeManager());

        try {
            tx.begin("sessionloader");
            // load the stored data:
            InputStream istream = new BufferedInputStream(new FileInputStream(f));
            ObjectInputStream p = new ObjectInputStream(istream);
            int size = p.readInt();
            int ct = 0;
            Hashtable newSessions = new Hashtable();

            while (ct < size) {
                Session session = (Session) engine.deserialize(p);

                if ((now - session.lastTouched()) < (sessionTimeout * 60000)) {
                    session.setApp(app);
                    newSessions.put(session.getSessionId(), session);
                }

                ct++;
            }

            p.close();
            istream.close();
            sessions = newSessions;
            app.logEvent("loaded " + newSessions.size() + " sessions from file");
            tx.commit();
        } catch (FileNotFoundException fnf) {
            // suppress error message if session file doesn't exist
            tx.abort();
        } catch (Exception e) {
            app.logError("error loading session data.", e);
            tx.abort();
        } finally {
            tx.closeConnections();
        }

    }
View Full Code Here

TOP

Related Classes of helma.objectmodel.db.Transactor

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.