Example usage for java.util ConcurrentModificationException ConcurrentModificationException

List of usage examples for java.util ConcurrentModificationException ConcurrentModificationException

Introduction

In this page you can find the example usage for java.util ConcurrentModificationException ConcurrentModificationException.

Prototype

public ConcurrentModificationException() 

Source Link

Document

Constructs a ConcurrentModificationException with no detail message.

Usage

From source file:jp.co.nemuzuka.service.impl.MilestoneServiceImpl.java

@Override
public void delete(MilestoneForm form, String projectKeyToString) {
    Key key = Datastore.stringToKey(form.keyToString);
    Long version = ConvertUtils.toLong(form.versionNo);
    //version?Key?projectKey??
    MilestoneModel model = milestoneDao.get(key, version, projectKeyToString);
    if (model == null) {
        //??????Exceptionthrow
        throw new ConcurrentModificationException();
    }/*from  w w  w  . java 2s  .c om*/
    milestoneDao.delete(model.getKey());
}

From source file:jp.co.nemuzuka.service.impl.UploadFileServiceImpl.java

@Override
public void delete(String uploadFileKeyString, String ticketKeyToString, String projectKeyString,
        Long version) {/*from   www  . j a  va  2 s .c  o m*/

    //?
    UploadFileModel model = uploadFileDao.get(uploadFileKeyString, ticketKeyToString, projectKeyString,
            version);
    if (model == null) {
        //??????Exception
        throw new ConcurrentModificationException();
    }
    delete(model);
}

From source file:jp.co.nemuzuka.service.impl.CommentServiceImpl.java

@Override
public void delete(Key refsKey, String commentKeyString, Long commentVersionNo) {
    CommentModel model = commentDao.get(commentKeyString, commentVersionNo, refsKey);
    if (model == null) {
        //??????Exceptionthrow
        throw new ConcurrentModificationException();
    }/*from  w  w  w  . ja  v  a  2s  .  c o  m*/
    commentDao.delete(model.getKey());
}

From source file:jp.co.nemuzuka.service.impl.MemberServiceImpl.java

@Override
public void put(MemberForm form) {

    MemberModel model = null;//from w  w w  . j  a v a 2 s. co m
    if (StringUtils.isNotEmpty(form.keyToString)) {
        //??
        Key key = Datastore.stringToKey(form.keyToString);
        Long version = ConvertUtils.toLong(form.versionNo);
        //version?Key??
        model = memberDao.get(key, version);
        if (model == null) {
            //??????Exceptionthrow
            throw new ConcurrentModificationException();
        }
    } else {
        //??????Key????
        if (Datastore.putUniqueValue(UniqueKey.member.name(), form.mail) == false) {
            throw new AlreadyExistKeyException();
        }
        model = new MemberModel();
        reSetMemberKeyEntity();
    }

    //??????
    setModel(model, form);
    memberDao.put(model);
}

From source file:jp.co.nemuzuka.service.impl.ProjectServiceImpl.java

@Override
public void delete(ProjectForm form) {
    //version?Key??
    Key key = Datastore.stringToKey(form.keyToString);
    Long version = ConvertUtils.toLong(form.versionNo);
    ProjectModel model = projectDao.get(key, version);
    if (model == null) {
        //??????Exceptionthrow
        throw new ConcurrentModificationException();
    }/*from  w w  w .  j a va  2  s  . co  m*/
    //
    projectDao.delete(model.getKey());

    //?
    List<ProjectMemberModel> list = projectMemberDao.getList(form.keyToString, null);
    List<Key> keyList = new ArrayList<Key>();
    for (ProjectMemberModel target : list) {
        keyList.add(target.getKey());
    }
    projectMemberDao.delete(keyList.toArray(new Key[0]));
}

From source file:UnifyHash.java

public Iterator iterator() {
    ///#ifdef JDK12
    cleanUp();//from ww  w .  j  a v a  2s . com
    ///#endif

    return new Iterator() {
        private int bucket = 0;
        private int known = modCount;
        private Bucket nextBucket;
        private Object nextVal;

        {
            internalNext();
        }

        private void internalNext() {
            while (true) {
                while (nextBucket == null) {
                    if (bucket == buckets.length)
                        return;
                    nextBucket = buckets[bucket++];
                }

                nextVal = nextBucket.get();
                if (nextVal != null)
                    return;

                nextBucket = nextBucket.next;
            }
        }

        public boolean hasNext() {
            return nextBucket != null;
        }

        public Object next() {
            if (known != modCount)
                throw new ConcurrentModificationException();
            if (nextBucket == null)
                throw new NoSuchElementException();
            Object result = nextVal;
            nextBucket = nextBucket.next;
            internalNext();
            return result;
        }

        public void remove() {
            throw new UnsupportedOperationException();
        }
    };
}

From source file:jp.co.nemuzuka.service.impl.MemberServiceImpl.java

@Override
public void delete(MemberForm form) {
    //version?Key??
    Key key = Datastore.stringToKey(form.keyToString);
    Long version = ConvertUtils.toLong(form.versionNo);
    MemberModel model = memberDao.get(key, version);
    if (model == null) {
        //??????Exceptionthrow
        throw new ConcurrentModificationException();
    }/*from  ww  w  .j av  a 2  s. c  om*/
    //
    memberDao.delete(model.getKey());
    //???Model??
    Datastore.deleteUniqueValue(UniqueKey.member.name(), model.getMail());

    //?
    reSetMemberKeyEntity();
}

From source file:CircularQueue.java

public Iterator iterator() {
    return new Iterator() {
        private final int ci = consumerIndex;
        private final int pi = producerIndex;
        private int s = size;
        private int i = ci;

        public boolean hasNext() {
            checkForModification();// ww w  .  ja v a 2s  . c  om
            return s > 0;
        }

        public Object next() {
            checkForModification();
            if (s == 0)
                throw new NoSuchElementException();

            s--;
            Object r = q[i];
            i = (i + 1) & bitmask;

            return r;
        }

        public void remove() {
            throw new UnsupportedOperationException();
        }

        private void checkForModification() {
            if (ci != consumerIndex)
                throw new ConcurrentModificationException();
            if (pi != producerIndex)
                throw new ConcurrentModificationException();
        }
    };
}

From source file:jp.co.nemuzuka.service.impl.TodoServiceImpl.java

@Override
public void updateTodoStatus(TodoForm form, String email) {
    TodoModel model = null;/*from w  w  w  .  ja v  a  2  s  .  com*/
    Key memberKey = memberService.getKey(email);
    Key key = Datastore.stringToKey(form.keyToString);
    Long version = ConvertUtils.toLong(form.versionNo);
    //key????Key??
    model = todoDao.get(key, version, memberKey);
    if (model == null) {
        //??????Exceptionthrow
        throw new ConcurrentModificationException();
    }

    TodoStatus status = TodoStatus.fromCode(form.todoStatus);
    if (status == null) {
        status = TodoStatus.nothing;
    }
    model.setStatus(status);
    todoDao.put(model);
}

From source file:UnifyHash.java

public Iterator iterateHashCode(final int hash) {
    ///#ifdef JDK12
    cleanUp();/*from   ww w. jav a2 s. c  o  m*/
    ///#endif
    return new Iterator() {
        private int known = modCount;
        private Bucket nextBucket = buckets[Math.abs(hash % buckets.length)];
        private Object nextVal;

        {
            internalNext();
        }

        private void internalNext() {
            while (nextBucket != null) {
                if (nextBucket.hash == hash) {
                    nextVal = nextBucket.get();
                    if (nextVal != null)
                        return;
                }

                nextBucket = nextBucket.next;
            }
        }

        public boolean hasNext() {
            return nextBucket != null;
        }

        public Object next() {
            if (known != modCount)
                throw new ConcurrentModificationException();
            if (nextBucket == null)
                throw new NoSuchElementException();
            Object result = nextVal;
            nextBucket = nextBucket.next;
            internalNext();
            return result;
        }

        public void remove() {
            throw new UnsupportedOperationException();
        }
    };
}