@Override
    public void run() {
        boolean stop = false;
        while (!isInterrupted() && !stop) try {
            Thread.sleep(1000);
            if (appBehaviorObserver == null) continue;
            ResourcePrincipal[] tmp = bean.getApplications();

            Set<ResourcePrincipal> newSet = new HashSet<ResourcePrincipal>(tmp.length);

            for (int i = 0; i < tmp.length; i++) {
                if (!principals.contains(tmp[i])) appBehaviorObserver.newApp(tmp[i]);
                else appBehaviorObserver.informationChange(tmp[i]);
                newSet.add(tmp[i]);
            }

            for (ResourcePrincipal rp : principals)
                if (!newSet.contains(rp))
                    appBehaviorObserver.removeApp(rp);

            principals = newSet;

            stop = appBehaviorObserver.isStopped();

        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }