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:com.ebay.erl.mobius.core.collection.BigTupleListIterator.java

private void checkConcurrentModification() {
    if (this.bigList.size() != this.totalRecords) {
        throw new ConcurrentModificationException();
    }/*from w ww  . j  av a  2 s  . c  om*/
}

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

@Override
public void put(TodoForm form, String mail) {

    TodoModel model = null;//from   w ww  .  j  av a  2s.co  m
    Key memberKey = memberService.getKey(mail);
    if (StringUtils.isNotEmpty(form.keyToString)) {
        //??
        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();
        }
    } else {
        //????
        model = new TodoModel();
        model.setCreateMemberKey(memberKey);
    }
    //??????
    setModel(model, form);
    todoDao.put(model);

    //??TODO
    putTodoTag(form.tag, mail);
}

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

@Override
public void put(PersonForm form) {
    //??/*from w ww .  j  a v a 2  s . c o m*/
    Key key = Datastore.stringToKey(form.keyToString);
    Long version = ConvertUtils.toLong(form.versionNo);
    //version?Key??
    MemberModel model = memberDao.get(key, version);
    if (model == null) {
        //??????Exceptionthrow
        throw new ConcurrentModificationException();
    }
    //???
    model.setName(form.name);
    model.setMemo(new Text(StringUtils.defaultString(form.memo)));
    memberDao.put(model);
}

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

@Override
public void delete(TodoForm form, String mail) {
    Key key = Datastore.stringToKey(form.keyToString);
    Key memberKey = memberService.getKey(mail);
    Long version = ConvertUtils.toLong(form.versionNo);
    //key????Key??
    TodoModel model = todoDao.get(key, version, memberKey);
    if (model == null) {
        //??????Exceptionthrow
        throw new ConcurrentModificationException();
    }/*www.j a  va2s.co m*/
    todoDao.delete(key);
}

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

@Override
public void put(TicketForm form, String projectKeyString)
        throws NotExistTicketException, ParentSelfTicketException {
    TicketModel model = null;/* ww w  .  j a v a2 s  .  c  o m*/
    Key projectKey = Datastore.stringToKey(projectKeyString);
    if (StringUtils.isNotEmpty(form.keyToString)) {
        //??
        Key key = Datastore.stringToKey(form.keyToString);
        Long version = ConvertUtils.toLong(form.versionNo);
        //Key?Key????
        model = ticketDao.get(key, version, projectKey);
        if (model == null) {
            //??????Exceptionthrow
            throw new ConcurrentModificationException();
        }
    } else {
        model = new TicketModel();
        model.setProjectKey(projectKey);
    }
    setModel(model, form);
    ticketDao.put(model);
}

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

@Override
public void putComment(TodoCommentForm form, String email) {
    //?????????//from   w ww .j a  va2 s  . co m
    Key todoModelKey = Datastore.stringToKey(form.keyToString);
    Key memberKey = memberService.getKey(email);

    //Key??Key??
    TodoModel model = todoDao.getWithMemberKey(todoModelKey, memberKey);
    if (model == null) {
        //??????Exceptionthrow
        throw new ConcurrentModificationException();
    }

    //???????
    TodoStatus status = TodoStatus.fromCode(form.status);
    if (status == null) {
        status = TodoStatus.nothing;
    }
    if (model.getStatus().equals(status) == false) {
        Long versonNo = ConvertUtils.toLong(form.versionNo);
        //??????
        if (model.getVersion().equals(versonNo) == false) {
            //???????????Exceptionthrow
            throw new ConcurrentModificationException();
        }
        model.setStatus(status);
        todoDao.put(model);
    }

    //
    commentService.put(todoModelKey, form.comment, email);
}

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

@Override
public void delete(TicketForm form, String projectKeyString) {
    Key projectKey = Datastore.stringToKey(projectKeyString);
    Key key = Datastore.stringToKey(form.keyToString);
    Long version = ConvertUtils.toLong(form.versionNo);
    //Key?Key????
    TicketModel model = ticketDao.get(key, version, projectKey);
    if (model == null) {
        //??????Exceptionthrow
        throw new ConcurrentModificationException();
    }//w  w w.  j a v  a 2s . co  m
    ticketDao.delete(key);
}

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

@Override
public void deleteComment(String keyString, String commentKeyString, Long commentVersionNo, String email) {

    //TODO??/*  w  ww  .j  a va  2s . co m*/
    Key todoModelKey = Datastore.stringToKey(keyString);
    Key memberKey = memberService.getKey(email);

    //Key??Key??
    TodoModel model = todoDao.getWithMemberKey(todoModelKey, memberKey);
    if (model == null) {
        //??????Exceptionthrow
        throw new ConcurrentModificationException();
    }

    //
    commentService.delete(todoModelKey, commentKeyString, commentVersionNo);
}

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

@Override
public void updateTicketStatus(TicketForm form, String projectKeyString) {
    Key projectKey = Datastore.stringToKey(projectKeyString);
    Key key = Datastore.stringToKey(form.keyToString);
    Long version = ConvertUtils.toLong(form.versionNo);
    //Key?Key????
    TicketModel model = ticketDao.get(key, version, projectKey);
    if (model == null) {
        //??????Exceptionthrow
        throw new ConcurrentModificationException();
    }/*from  w  w  w .  java  2 s.  co m*/
    model.setStatus(form.status);
    ticketDao.put(model);
}

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

@Override
public void putComment(TicketCommentForm form, String projectKeyString, String email) {

    //?????????/*from   w  ww .  java 2 s . c om*/
    Key ticketModelKey = Datastore.stringToKey(form.keyToString);
    Key projectKey = Datastore.stringToKey(projectKeyString);

    //Key???
    TicketModel model = ticketDao.getWithProjectKey(ticketModelKey, projectKey);
    if (model == null) {
        //??????Exceptionthrow
        throw new ConcurrentModificationException();
    }

    //???????
    if (model.getStatus().equals(form.status) == false) {
        Long versonNo = ConvertUtils.toLong(form.versionNo);
        //??????
        if (model.getVersion().equals(versonNo) == false) {
            //???????????Exceptionthrow
            throw new ConcurrentModificationException();
        }
        model.setStatus(form.status);
        ticketDao.put(model);
    }
    //
    commentService.put(ticketModelKey, form.comment, email);
}