问题:
多线程方法中使用了共享变量SimpleDateFormat,报如下错误:
java.lang.NumberFormatException: multiple points
at sun.misc.FloatingDecimal.readJavaFormatString(FloatingDecimal.java:1084
原因:
解决:
在线程方法中,new SimpleDateFormat();
例:
SimpleDateFormat sdf = new SimpleDateFormat();
class QueryUserByNoThread extends Thread{
LoginOpr loginOpr;
CountDownLatch countdown ;
Map<String, Object> map;//构造返回信息
Group group;
String grpUId;
SimpleDateFormat sdf;
List<Cust> listCust;
List<GroupMember> listMem;
List<User> listUser;
User user;
Map<String, String> member = new HashMap<String, String>();
/**
* @param bo
* @param loginOpr
*/
public QueryUserByNoThread(LoginOpr loginOpr,CountDownLatch cdown,Map<String, String> member,Group group,String grpUId,List<Cust> listCust,List<GroupMember> listMem,List<User> listUser,User user,Map<String, Object> map) {
super();
this.member.putAll(member);
this.countdown = cdown;
this.map = map;
this.group=group;
this.grpUId = grpUId;
this.sdf = new SimpleDateFormat(Constants.DATE_MODEL_8);
this.listMem = listMem;
this.listUser = listUser;
this.loginOpr = loginOpr;
this.user=user;
}