private void checkClientStatuses() {
        long dif;
        ServerSideJob j;
        JobRecord jr;
        Calendar lastOnline;
        Communicator comm;
        final Collection<JobRecord> remove = new LinkedList<JobRecord>();
        synchronized (activeJobs) {
            Iterator<JobRecord> it = activeJobs.iterator();
            while (it.hasNext()) {
                jr = it.next();
                j = jr.getJob();
                if (j.getStatus().equals(JobStatus.ACCEPTED)) {
                    comm = jr.getOwner();
                    if (!isClientOnline(comm)) {
                        lastOnline = lastTimeOnline.get(comm);
                        if (lastOnline == null) {
                            lastOnline = jr.getLastAction();
                        }

                        dif = Calendar.getInstance().getTimeInMillis() - lastOnline.getTimeInMillis();
                        if (dif > Timeout.getTimeout(Timeout.TimeoutType.JOB_CHECK)) {
                            try {
                                j.cancelJob();
                                j.setStatus(JobStatus.SUBMITTED);
                            } catch (ConnectionException ex) {
                                LOG.log(Level.WARNING, "Could not contact client with ID {0} for job cancelation.", jr.getOwner().getTargetId());
                            }
                            storeJobAction(j, jr.getOwner().getTargetId(), JobConstants.JOB_CANCEL);
                            LOG.log(Level.INFO, "Jobs (id {0}) owner went offline, so it was cancelled and returned to queue.", j.getId());
                            if (!jobQueue.contains(j)) {
                                jobQueue.addFirst(j);
                            }
                            remove.add(jr);
                        }
                    }
                }
            }
            activeJobs.removeAll(remove);
        }
    }