Package org.netbeans.modules.exceptions.entity

Examples of org.netbeans.modules.exceptions.entity.Logfile


                if (closed || DEFAULT != LogsManager.this) {
                    LOG.log(Level.INFO, "Stopping processing at {0} files", cnt);
                    break;
                }

                Logfile tempLog = LogFileTask.getLogInfo(f.getName(), em);
                if (tempLog == null){
                    tempLog = new Logfile(LogFileTask.getIdSes(f.getName()), LogFileTask.getSessionNumber(f.getName()));
                    em.persist(tempLog);
                } else if (isOldBuild(tempLog)){
                    LOG.log(Level.FINER, "Skipping old build.", f);
                    continue;
                }
                final Logfile log = tempLog;
                try {
                    assert log != null;
                    final List<Value> recompute = statisticsToRecompute(em, log);
                    if (recompute.isEmpty()) {
                        LOG.log(Level.FINER, "File {0} is up to date.", f);
                    } else {
                        if (LOG.isLoggable(Level.FINER)) {
                            StringBuilder sb = new StringBuilder();
                            sb.append("File ");
                            sb.append(f.getPath());
                            sb.append(" needs reparse for ");
                            String sep = "";
                            for (Value<?> value : recompute) {
                                sb.append(sep);
                                sb.append(value.statistics.name);
                                sep = ", ";
                            }
                            LOG.finer(sb.toString());
                        }
                        class RecomputeTask extends LogFileTask{

                            public RecomputeTask() {
                                super(f, null, null);
                            }

                            @Override
                            public void run() {
                                if (closed) {
                                    LOG.info("Processing cancelled");
                                    return;
                                }
                                runningTask = this;
                                handleAddNewLog(f, recompute, false, log, em);
                                notifyFinished();
                            }
                        }
                        em.getTransaction().begin();
                        new RecomputeTask().run();
                        em.getTransaction().commit();
                    }

                    LOG.log(Level.FINE, "Recomputing {0}", log.getFileName());
                    for (Value<?> v : sum) {
                        addDataForLog(v, log, em);
                    }
                } catch (ThreadDeath td) {
                    throw td;
                } catch (Throwable t) {
                    if (log == null){
                        LOG.log(Level.SEVERE, "Exception when processing: " , t);
                    }else{
                        LOG.log(Level.SEVERE, "Exception when processing: " + log.getFileName(), t);
                    }
                    em.getTransaction().rollback();
                    break;
                }
            }
View Full Code Here


            }

            public TransactionResult runQuery(EntityManager em) {
                if (read) {
                    LOG.log(Level.FINE, "reading previously stored globals");
                    Logfile global = getGlobalLog(em);
                    if (global == null) {
                        LOG.log(Level.WARNING, "no stored globals");
                    } else {
                        List<Value> globalsToRecompute = statisticsToRecompute(em, global);
                        if (!globalsToRecompute.isEmpty()){
                            LOG.log(Level.WARNING, "global data are not actual - there some new statistics or some version has rised");
                        }else{
                            List<Value> loadedStatistics = new ArrayList<Value>(statistics.size());
                            for (Value<?> v : statistics) {
                                addStatisticsData(loadedStatistics, v.statistics);
                            }
                            for (Value<?> v : loadedStatistics) {
                                addDataForLog(v, global, em);
                            }
                            //replace global data after loading whole global data
                            statistics = loadedStatistics;
                            LOG.log(Level.INFO, "done reading previously stored globals");
                            prepareVersionRecount(em);
                        }
                    }
                    postVerificationTask(verify);
                    return TransactionResult.COMMIT;
                } else {//write
                    LOG.log(Level.FINE, "storing globals");
                    Logfile global = getGlobalLog(em);
                    for (Value<?> v : sum) {
                        if (closed){
                            break;
                        }
                        v.persist(global, em);
View Full Code Here

                    }
                }
            }

            private Logfile getGlobalLog(EntityManager em) {
                Logfile globalLogFile = LogFileTask.getLogInfo("global", 0, em);
                if (globalLogFile == null) {
                    globalLogFile = new Logfile("global", 0);
                    em.persist(globalLogFile);
                }
                return globalLogFile;
            }
View Full Code Here

            long time = System.currentTimeMillis();
            taskEm = PersistenceUtils.getInstance().createEntityManager();
            taskEm.getTransaction().begin();

            LOG.fine("processing parsing " + f);
            logFile = new Logfile(getIdSes(f.getName()), getSessionNumber(f.getName()));
            logFile.setIpAddr(remoteHost);
            taskEm.persist(logFile);
            LOG.fine("IP address stored as " + remoteHost + " for " + f);
            handleAddNewLog(f, statisticsGetter.getStatistics(), true, logFile, taskEm);
View Full Code Here

        return new Counts(0,0);
    }

    @Override
    protected Counts finishSessionUpload(String userId, int sessionNumber, boolean initialParse, Counts d) {
        Logfile l = LogFileTask.getRunningTask().getLogInfo();
        Long build = l == null ? null : l.getBuildnumber();
        if (build == null || build <= 100607L) {
            // ignore old builds, those created before June 07, 2010
            return new Counts(0,0);
        }
       
View Full Code Here

                final File f = filesProvider.getNextFile();
                if (f == null) {
                    break;
                }

                final Logfile log = LogFileTask.getLogInfo(f.getName(), em);
                if (log == null) {
                    continue;
                }
                if (log.getProductVersionId() == null) {
                    continue;
                }
                if (!version.equals(log.getProductVersionId().getNbversionId())) {
                    continue;
                }
                LOG.log(Level.FINE, "Recomputing {0} for {1}", new Object[]{log.getFileName(), version.getVersion()});
                for (Value<?> v : sum) {
                    LogsManager.addDataForLog(v, log, em);
                }
                logsCount++;
            }
View Full Code Here

    }

    private void persistResult(EntityManager em) {
        LOG.log(Level.FINE, "Persisting data for {0}", version.getVersion());
        String userdir = "global" + version.getVersion();
        Logfile log = LogFileTask.getLogInfo(userdir, 0, em);
        if (log == null) {
            log = new Logfile(userdir, 0);
            em.persist(log);
        }
        for (Value<?> v : sum) {
            v.persist(log, em);
        }
View Full Code Here

        LOG.log(Level.FINE, "reading previously stored globals for version {0}", version.getVersion());
        final String userdir = "global" + version.getVersion();
        org.netbeans.web.Utils.processPersistable(new Persistable.Query() {

            public TransactionResult runQuery(EntityManager em) {
                Logfile log = LogFileTask.getLogInfo(userdir, 0, em);
                if (log == null) {
                    LOG.log(Level.FINE, "no stored globals");
                } else {
                    for (Value<?> v : statisticsList) {
                        LogsManager.addDataForLog(v, log, em);
View Full Code Here

        Throwable thrown = new NullPointerException("TESTING NULL POINTER");
        EntityManager em = perUtils.createEntityManager();
        em.getTransaction().begin();
        String userId = "file";
        int session = 1;
        Logfile log = new Logfile(userId, session);
        TestLogFileTask task = new TestLogFileTask(em, log);
        DbInsertion insertion = new DbInsertion(rec, thrown, task);
        ExceptionsData excData = new ExceptionsData();
        insertion.start(excData);
        task.markFinished();
View Full Code Here

        Throwable thrown = new NullPointerException("TESTING NULL POINTER");
        EntityManager em = perUtils.createEntityManager();
        em.getTransaction().begin();
        String userId = "file";
        int session = 1;
        Logfile log = new Logfile(userId, session);
        TestLogFileTask task = new TestLogFileTask(em, log);
        DbInsertion insertion = new DbInsertion(rec, thrown, task);
        ExceptionsData excData = new ExceptionsData();
        insertion.start(excData);
        task.markFinished();
View Full Code Here

TOP

Related Classes of org.netbeans.modules.exceptions.entity.Logfile

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.